Class: Pgchief::Cli

Inherits:
Object
  • Object
show all
Includes:
TTY::Option
Defined in:
lib/pgchief/cli.rb

Overview

Command line interface and option parsing

Instance Method Summary collapse

Instance Method Details

#runObject

rubocop:disable Metrics/MethodLength, Metrics/AbcSize



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/pgchief/cli.rb', line 52

def run # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
  if params[:help]
    print help
  elsif params[:init]
    Pgchief::Command::ConfigCreate.call
  elsif params[:version]
    puts Pgchief::VERSION
  elsif params[:restore]
    puts Pgchief::Command::QuickRestore.call(params, params[:restore])
  elsif params[:backup]
    puts Pgchief::Command::QuickBackup.call(params, params[:backup])
  else
    Pgchief::Prompt::Start.call(params)
  end
rescue Pgchief::Error => e
  puts e.message
end