Class: Laws::CLI
- Inherits:
-
Object
- Object
- Laws::CLI
- Defined in:
- lib/laws/cli.rb
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #parse_options ⇒ Object
Constructor Details
Instance Method Details
#parse_options ⇒ Object
9 10 11 12 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 40 41 42 |
# File 'lib/laws/cli.rb', line 9 def OptionParser.new do |opts| opts. = 'Usage: laws [command]' opts.on('-h', '--help', 'Display this help message') do puts opts exit end opts.separator "\nCommands:" opts.separator ' ecs execute-command Run interactive ECS execute-command' opts.separator ' secretsmanager get-secret-value Get and display secret value' end.parse! # Handle commands command = ARGV.join(' ') # Join arguments to handle multi-word commands begin case command when 'ecs execute-command' @ecs.execute_command when 'secretsmanager get-secret-value' @secretsmanager.get_secret_value when nil, '' puts 'No command specified. Use --help for usage information.' exit 1 else puts "Unknown command: #{command}" exit 1 end rescue TTY::Reader::InputInterrupt puts "\nOperation cancelled." exit 1 end end |