Class: Navio::CLI
- Inherits:
-
Object
- Object
- Navio::CLI
- Defined in:
- lib/navio/cli.rb
Overview
CLI class provides command-line interface for managing project URL shortcuts.
Constant Summary collapse
- COMMANDS =
Command mapping with command names as keys and method names as values
{ "add" => :add_shortcut, "set" => :add_shortcut, "remove" => :remove_shortcut, "rm" => :remove_shortcut, "delete" => :remove_shortcut, "list" => :list_shortcuts, "ls" => :list_shortcuts, "help" => :show_help }.freeze
Instance Method Summary collapse
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #run(args) ⇒ Object
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
21 22 23 24 |
# File 'lib/navio/cli.rb', line 21 def initialize @config = Config.new @launcher = Launcher.new end |
Instance Method Details
#run(args) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/navio/cli.rb', line 26 def run(args) return show_help if args.empty? command = args.shift if COMMANDS.key?(command) send(COMMANDS[command], args) else open_url(command) || show_help end end |