Class: Coaster::Git::Options

Inherits:
CmdOptions show all
Defined in:
lib/coaster/git/options.rb

Constant Summary collapse

OPTION_PARSER =
{
  'git' => {
    nil => proc do
      OptionParser.new do |opts|
        opts.on('-c', '--config-env=NAME=VALUE') { |v|
          name, envvar = v.split('=')
          @hash['--config-env'] ||= {}
          @hash['--config-env'][name] = envvar
        }
      end
    end,
  },
  'config' => {
    nil => proc do
      OptionParser.new do |opts|
      end
    end,
  },
  'status' => {
    nil => proc do
      OptionParser.new do |opts|
      end
    end,
  },
  'add' => {
    nil => proc do
      OptionParser.new do |opts|
      end
    end,
  },
  'commit' => {
    nil => proc do
      OptionParser.new do |opts|
        opts.on('-m', '--message') { |v| @hash['--message'] = v }
      end
    end,
  },
  'fetch' => {
    nil => proc do
      OptionParser.new do |opts|
      end
    end,
  },
  'branch' => {
    nil => proc do
      OptionParser.new do |opts|
      end
    end
  },
  'checkout' => {
    nil => proc do
      OptionParser.new do |opts|
      end
    end
  },
  'merge' => {
    nil => proc do
      OptionParser.new do |opts|
        opts.on('-m', '--message') { |v| @hash['--message'] = v }
        opts.on('--no-commit') { |v| @hash['--no-commit'] = '' }
      end
    end
  },
  'log' => {
    nil => proc do
      OptionParser.new do |opts|
      end
    end
  },
  'diff' => {
    nil => proc do
      OptionParser.new do |opts|
      end
    end
  },
  'submodule' => {
    nil => proc do
      OptionParser.new do |opts|
      end
    end,
    'add' => proc do
      OptionParser.new do |opts|
      end
    end,
    'init' => proc do
      OptionParser.new do |opts|
      end
    end,
    'update' => proc do
      OptionParser.new do |opts|
      end
    end
  },
  'ls-tree' => {
    nil => proc do
      OptionParser.new do |opts|
      end
    end
  },
  'rev-parse' => {
    nil => proc do
      OptionParser.new do |opts|
      end
    end
  },
}

Instance Attribute Summary

Attributes inherited from CmdOptions

#args, #cmd, #options, #remain_args, #str, #sub_cmd

Instance Method Summary collapse

Methods inherited from CmdOptions

#initialize, #merge, option_v_to_s, options_h_to_s, options_to_s, #parser, #to_h, #to_s

Constructor Details

This class inherits a constructor from Coaster::CmdOptions

Instance Method Details

#parser_proc(cmd, sub_cmd, *args) ⇒ Object



113
114
115
# File 'lib/coaster/git/options.rb', line 113

def parser_proc(cmd, sub_cmd, *args)
  OPTION_PARSER[cmd][sub_cmd]
end