Module: EverydayThorUtil::SubCommandFlagHelpers

Included in:
SubCommandHelpers
Defined in:
lib/everyday_thor_util/plugin-helper.rb

Instance Method Summary collapse

Instance Method Details

#copy_opt(opts, v, opt_name, extra_condition = true) ⇒ Object



74
75
76
# File 'lib/everyday_thor_util/plugin-helper.rb', line 74

def copy_opt(opts, v, opt_name, extra_condition = true)
  opts[opt_name] = v[:options][opt_name] if v[:options][opt_name] && extra_condition
end

#copy_opts(opts, v, *opt_name) ⇒ Object



70
71
72
# File 'lib/everyday_thor_util/plugin-helper.rb', line 70

def copy_opts(opts, v, *opt_name)
  opt_name.each { |n| copy_opt(opts, v, n) }
end

#map_flag_opts(v) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/everyday_thor_util/plugin-helper.rb', line 62

def map_flag_opts(v)
  opts = {}
  name = v[:options][:name].to_sym
  copy_opts(opts, v, :desc, :banner, :default, :type, :aliases)
  copy_opt(opts, v, :required, !v[:options][:default])
  return name, opts
end