Class: Trout::CLI
- Inherits:
-
Object
- Object
- Trout::CLI
- Defined in:
- lib/trout/cli.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#command ⇒ Object
Returns the value of attribute command.
-
#file ⇒ Object
Returns the value of attribute file.
-
#option_parser ⇒ Object
Returns the value of attribute option_parser.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(arguments) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(arguments) ⇒ CLI
Returns a new instance of CLI.
12 13 14 15 |
# File 'lib/trout/cli.rb', line 12 def initialize(arguments) self.arguments = arguments self.option_parser = end |
Instance Attribute Details
#arguments ⇒ Object
Returns the value of attribute arguments.
10 11 12 |
# File 'lib/trout/cli.rb', line 10 def arguments @arguments end |
#command ⇒ Object
Returns the value of attribute command.
10 11 12 |
# File 'lib/trout/cli.rb', line 10 def command @command end |
#file ⇒ Object
Returns the value of attribute file.
10 11 12 |
# File 'lib/trout/cli.rb', line 10 def file @file end |
#option_parser ⇒ Object
Returns the value of attribute option_parser.
10 11 12 |
# File 'lib/trout/cli.rb', line 10 def option_parser @option_parser end |
Class Method Details
.run(arguments) ⇒ Object
6 7 8 |
# File 'lib/trout/cli.rb', line 6 def self.run(arguments) new(arguments).run end |
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/trout/cli.rb', line 17 def run case command when 'checkout' build_file git_url = next_argument end_arguments file.copy_from(git_url) when 'update' build_file end_arguments file.update when 'help', nil puts option_parser if arguments_left? puts usage_for(next_argument) end else unknown_command(command) end end |