Class: NatsWork::CLI
- Inherits:
-
Object
- Object
- NatsWork::CLI
- Defined in:
- lib/natswork/cli.rb
Instance Method Summary collapse
-
#initialize(argv = ARGV) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(argv = ARGV) ⇒ CLI
8 9 10 11 |
# File 'lib/natswork/cli.rb', line 8 def initialize(argv = ARGV) @argv = argv.dup @options = {} end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/natswork/cli.rb', line 13 def run parser = create_parser parser.parse!(@argv) command = @argv.shift || 'help' case command when 'status' show_status when 'stats' show_stats when 'health' show_health when 'errors' show_errors when 'workers' show_workers when 'monitor' start_monitor when 'help', '--help', '-h' puts parser.help else puts "Unknown command: #{command}" puts parser.help exit 1 end end |