Class: Waves::CLI::App
- Inherits:
-
Object
- Object
- Waves::CLI::App
- Defined in:
- lib/waves/cli/app.rb
Constant Summary collapse
- COMMANDS =
%w[login account list search show transcript].freeze
Instance Method Summary collapse
-
#initialize(argv:, stdin:, stdout:, stderr:, env:, config:, client_class:) ⇒ App
constructor
A new instance of App.
- #start ⇒ Object
Constructor Details
#initialize(argv:, stdin:, stdout:, stderr:, env:, config:, client_class:) ⇒ App
Returns a new instance of App.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/waves/cli/app.rb', line 13 def initialize(argv:, stdin:, stdout:, stderr:, env:, config:, client_class:) @argv = argv.dup @stdin = stdin @stdout = stdout @stderr = stderr @env = env @config = config @client_class = client_class @formatter = Formatter.new(stdout: stdout) end |
Instance Method Details
#start ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/waves/cli/app.rb', line 24 def start , args = (@argv) command = args.shift return print_help if command.nil? return print_help(args.first) if command == "help" return print_help(command) if [:help] dispatch(command, args, ) rescue OptionParser::ParseError, CommandError, Waves::Error => error print_error(error, json: &.fetch(:json, false) || false) end |