Class: Hiera::Backend::Eyaml::CLI
- Inherits:
-
Object
- Object
- Hiera::Backend::Eyaml::CLI
- Defined in:
- lib/hiera/backend/eyaml/CLI.rb
Class Method Summary collapse
Class Method Details
.execute ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/hiera/backend/eyaml/CLI.rb', line 42 def self.execute executor = Eyaml::Options[:executor] begin result = executor.execute puts result unless result.nil? rescue Exception => e LoggingHelper.warn e. LoggingHelper.debug e.backtrace.join("\n") end end |
.parse ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/hiera/backend/eyaml/CLI.rb', line 14 def self.parse Utils.require_dir 'hiera/backend/eyaml/subcommands' Eyaml.subcommands = Utils.find_all_subclasses_of({ :parent_class => Hiera::Backend::Eyaml::Subcommands }).collect {|classname| Utils.snakecase classname} Eyaml.subcommand = ARGV.shift subcommand = case Eyaml.subcommand when nil ARGV.delete_if {true} "unknown_command" when /^\-/ ARGV.delete_if {true} "help" else Eyaml.subcommand end command_class = Subcommand.find subcommand = command_class.parse [:executor] = command_class = command_class.validate Eyaml::Options.set Eyaml::Options.trace end |