class Psychic::CLI

Constants

BUILT_IN_TASKS

Attributes

extra_args[RW]

Override Thor’s start to strip extra_args from ARGV before it’s processed

Public Class Methods

start(given_args = ARGV, config = {}) click to toggle source
Calls superclass method
# File lib/psychic/cli.rb, line 12
def start(given_args = ARGV, config = {})
  if given_args && (split_pos = given_args.index('--'))
    @extra_args = given_args.slice(split_pos + 1, given_args.length).map do | arg |
      # Restore quotes
      next unless arg.match(/\=/)
      lhs, rhs = arg.split('=')
      lhs = "\"#{lhs}\"" if lhs.match(/\s/)
      rhs = "\"#{rhs}\"" if rhs.match(/\s/)
      [lhs, rhs].join('=')
    end
    given_args = given_args.slice(0, split_pos)
  end
  super given_args, config
end

Public Instance Methods

extra_args() click to toggle source
# File lib/psychic/cli.rb, line 29
def extra_args
  self.class.extra_args
end