Class: ChefSearch::CLI
- Inherits:
-
Object
- Object
- ChefSearch::CLI
- Defined in:
- lib/chefsearch/cli.rb
Overview
CLI execution
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
-
#execute! ⇒ Object
Run the CLI command.
-
#initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel) ⇒ CLI
constructor
setup CLI options.
Constructor Details
#initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel) ⇒ CLI
setup CLI options
11 12 13 14 15 |
# File 'lib/chefsearch/cli.rb', line 11 def initialize(argv, stdin = STDIN, stdout = STDOUT, stderr = STDERR, kernel = Kernel) @argv, @stdin, @stdout, @stderr, @kernel = argv, stdin, stdout, stderr, kernel end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
8 9 10 |
# File 'lib/chefsearch/cli.rb', line 8 def opts @opts end |
Instance Method Details
#execute! ⇒ Object
Run the CLI command
18 19 20 21 22 23 24 25 26 |
# File 'lib/chefsearch/cli.rb', line 18 def execute! c = ChefSearch::Search.new(@opts.config) puts c.search(name: @opts.name, role: @opts.role, chef_environment: @opts.environment ) end |