Class: Appydave::Tools::Jump::Commands::Generate
- Defined in:
- lib/appydave/tools/jump/commands/generate.rb
Overview
Generate command creates shell aliases and help content
Constant Summary collapse
- VALID_TARGETS =
%w[aliases help ah-help all].freeze
- MAX_BACKUPS =
10- TITLE_MAPPINGS =
{ 'appydave' => 'Appy Dave', 'supportsignal' => 'SupportSignal', 'beauty-and-joy' => 'Beauty & Joy', 'david-cruwys' => 'David Cruwys', 'guy-monroe' => 'Guy Monroe', 'voz' => 'VOZ', 'kiros' => 'Kiros', 'aitldr' => 'AITLDR' }.freeze
Instance Attribute Summary collapse
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
-
#output_path ⇒ Object
readonly
Returns the value of attribute output_path.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Attributes inherited from Base
#config, #options, #path_validator
Instance Method Summary collapse
-
#initialize(config, target, output_path: nil, output_dir: nil, path_validator: PathValidator.new, **options) ⇒ Generate
constructor
rubocop:disable Metrics/ParameterLists.
-
#run ⇒ Object
rubocop:enable Metrics/ParameterLists.
Constructor Details
#initialize(config, target, output_path: nil, output_dir: nil, path_validator: PathValidator.new, **options) ⇒ Generate
rubocop:disable Metrics/ParameterLists
26 27 28 29 30 31 |
# File 'lib/appydave/tools/jump/commands/generate.rb', line 26 def initialize(config, target, output_path: nil, output_dir: nil, path_validator: PathValidator.new, **) super(config, path_validator: path_validator, **) @target = target @output_path = output_path @output_dir = output_dir end |
Instance Attribute Details
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
23 24 25 |
# File 'lib/appydave/tools/jump/commands/generate.rb', line 23 def output_dir @output_dir end |
#output_path ⇒ Object (readonly)
Returns the value of attribute output_path.
23 24 25 |
# File 'lib/appydave/tools/jump/commands/generate.rb', line 23 def output_path @output_path end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
23 24 25 |
# File 'lib/appydave/tools/jump/commands/generate.rb', line 23 def target @target end |
Instance Method Details
#run ⇒ Object
rubocop:enable Metrics/ParameterLists
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/appydave/tools/jump/commands/generate.rb', line 34 def run unless VALID_TARGETS.include?(target) return error_result( "Unknown generate target: #{target}", code: 'INVALID_INPUT', suggestion: "Valid targets: #{VALID_TARGETS.join(', ')}" ) end # Convert hyphenated targets to underscored method names method_name = "generate_#{target.tr('-', '_')}" send(method_name) end |