Sha256: e12ead546c8e825fdbdec3decf68d9034bb06317210bc407ff986c0ed226d38d

Contents?: true

Size: 638 Bytes

Versions: 1

Compression:

Stored size: 638 Bytes

Contents

require 'English'
require 'thor'

module Psychic
  class CLI < Thor
    BUILT_IN_TASKS = %w(bootstrap)

    class << self
      # Override Thor's start to strip extra_args from ARGV before it's processed
      attr_accessor :extra_args

      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)
          given_args = given_args.slice(0, split_pos)
        end
        super given_args, config
      end
    end

    no_commands do
      def extra_args
        self.class.extra_args
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
psychic-runner-0.0.7 lib/psychic/cli.rb