Class: Eco::CLI::Scripting

Inherits:
Object show all
Includes:
ArgsHelpers
Defined in:
lib/eco/cli/scripting.rb,
lib/eco/cli/scripting/argument.rb,
lib/eco/cli/scripting/arguments.rb,
lib/eco/cli/scripting/args_helpers.rb

Defined Under Namespace

Modules: ArgsHelpers Classes: Argument, Arguments

Instance Method Summary collapse

Methods included from ArgsHelpers

#arg?, #arg_order?, #arguments, #get_arg, #get_arg_index, #get_file, #is_modifier?, #known_argument, #stop_on_unknown!

Constructor Details

#initialize(argv = ARGV) ⇒ Scripting

Returns a new instance of Scripting.



10
11
12
# File 'lib/eco/cli/scripting.rb', line 10

def initialize(argv = ARGV)
  @argv = argv
end

Instance Method Details

#args_contain?(*values) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/eco/cli/scripting.rb', line 18

def args_contain?(*values)
  match?(argv, patterns, [:any, :or, :insensitive, :pattern])
end

#argvObject



14
15
16
# File 'lib/eco/cli/scripting.rb', line 14

def argv
  @argv.dup
end

#modifiers(*values) ⇒ Object



22
23
24
# File 'lib/eco/cli/scripting.rb', line 22

def modifiers(*values)
  values.select { |arg| is_modifier?(arg) }
end