Class: Polytrix::Command::Base

Inherits:
Object
  • Object
show all
Includes:
Polytrix::Core::FileSystemHelper, DefaultLogger, Logging
Defined in:
lib/polytrix/command.rb

Direct Known Subclasses

Action, List, Report, Test

Constant Summary collapse

SUPPORTED_EXTENSIONS =

Need standard executor…

%w(py rb js)

Instance Method Summary collapse

Methods included from Polytrix::Core::FileSystemHelper

#find_file, #recursive_parent_search

Methods included from StringHelpers

included

Methods included from StringHelpers::ClassMethods

#slugify

Methods included from DefaultLogger

included

Methods included from DefaultLogger::ClassMethods

#logger

Constructor Details

#initialize(cmd_args, cmd_options, options = {}) ⇒ Base

Contstructs a new Command object.

Parameters:

  • cmd_args (Array)

    remainder of the arguments from processed ARGV

  • cmd_options (Hash)

    hash of Thor options

  • options (Hash) (defaults to: {})

    configuration options

Options Hash (options):

  • :action (String)

    action to take, usually corresponding to the subcommand name (default: ‘nil`)

  • :help (proc)

    a callable that displays help for the command

  • :test_dir (Config)

    a Config object (default: ‘nil`)

  • :loader (Loader)

    a Loader object (default: ‘nil`)

  • :shell (String)

    a Thor shell object



25
26
27
28
29
30
31
32
33
34
# File 'lib/polytrix/command.rb', line 25

def initialize(cmd_args, cmd_options, options = {})
  @args = cmd_args
  @options = cmd_options
  @action = options.fetch(:action, nil)
  @help = options.fetch(:help, -> { 'No help provided' })
  @manifest_file = options.fetch('manifest', nil)
  @test_dir = options.fetch('test_dir', nil)
  @loader = options.fetch(:loader, nil)
  @shell = options.fetch(:shell)
end