Class: KBuilder::Watch::Cli
- Inherits:
-
Object
- Object
- KBuilder::Watch::Cli
- Extended by:
- Forwardable
- Defined in:
- lib/k_builder/watch/cli.rb
Overview
Command line interface for starting the watcher
Instance Attribute Summary collapse
-
#opts ⇒ Object
Returns the value of attribute opts.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Cli
constructor
A new instance of Cli.
- #options ⇒ Object
- #parse_arguments ⇒ Object
- #process_arguments ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ Cli
Returns a new instance of Cli.
19 20 21 22 23 |
# File 'lib/k_builder/watch/cli.rb', line 19 def initialize @opts = KBuilder::Watch::CliOptions.new process_arguments end |
Instance Attribute Details
#opts ⇒ Object
Returns the value of attribute opts.
15 16 17 |
# File 'lib/k_builder/watch/cli.rb', line 15 def opts @opts end |
Class Method Details
.parse_options ⇒ Object
25 26 27 |
# File 'lib/k_builder/watch/cli.rb', line 25 def self. new.opts end |
Instance Method Details
#options ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/k_builder/watch/cli.rb', line 36 def GetoptLong.new( ['--help' , '-h', GetoptLong::NO_ARGUMENT], ['--debug' , GetoptLong::NO_ARGUMENT], ['--new' , '-n', GetoptLong::OPTIONAL_ARGUMENT] ) end |
#parse_arguments ⇒ Object
44 45 46 47 48 49 |
# File 'lib/k_builder/watch/cli.rb', line 44 def parse_arguments .each do |opt, arg| # Arguments like -nKafeOwner and -n KafeOwner should both become 'KafeOwner' parse_option(opt, arg.strip) end end |
#process_arguments ⇒ Object
29 30 31 32 33 34 |
# File 'lib/k_builder/watch/cli.rb', line 29 def process_arguments parse_arguments set_watch_path_arg set_watch_path end |
#to_h ⇒ Object
51 52 53 |
# File 'lib/k_builder/watch/cli.rb', line 51 def to_h @opts.to_h end |