Class: Hyraft::CLI
- Inherits:
-
Object
- Object
- Hyraft::CLI
- Defined in:
- lib/hyraft/cli.rb
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
13 14 15 16 17 |
# File 'lib/hyraft/cli.rb', line 13 def initialize(argv) @argv = argv @command = argv[0] @app_name = argv[1] end |
Class Method Details
.start(argv) ⇒ Object
9 10 11 |
# File 'lib/hyraft/cli.rb', line 9 def self.start(argv) new(argv).execute end |
Instance Method Details
#execute ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/hyraft/cli.rb', line 19 def execute case @command when "do" do_application when "version", "-v", "--version" puts "Hyraft version #{VERSION}" when nil, "help", "-h", "--help" show_help else puts "Unknown command: #{@command}" show_help end end |