lib/hieracles/optparse.rb in hieracles-0.2.0 vs lib/hieracles/optparse.rb in hieracles-0.2.1

- old
+ new

@@ -2,52 +2,13 @@ class Optparse attr_reader :options, :payload - OPTIONS = { - config: { - has_arg: true, - aliases: ['c', 'conf', 'config'] - }, - format: { - has_arg: true, - aliases: ['f', 'format'] - }, - params: { - has_arg: true, - aliases: ['p', 'params'] - }, - hierafile: { - has_arg: true, - aliases: ['h', 'hierafile'] - }, - basepath: { - has_arg: true, - aliases: ['b', 'basepath'] - }, - encpath: { - has_arg: true, - aliases: ['e', 'encpath'] - }, - version: { - has_arg: false, - aliases: ['v', 'version'] - }, - yaml_facts: { - has_arg: true, - aliases: ['y', 'yaml'] - }, - json_facts: { - has_arg: true, - aliases: ['j', 'json'] - }, - interactive: { - has_arg: false, - aliases: ['i', 'interactive'] - } - } + def available_options + {} + end def initialize(array) @options = {} @payload = [] ok = optionkeys @@ -69,10 +30,10 @@ end end def optionkeys back = {} - OPTIONS.each do |k, v| + available_options.each do |k, v| v[:aliases].each do |a| back[a] = { var: k, has_args: v[:has_arg] } end end back