Class: Geet::Commandline::Configuration

Inherits:
Object
  • Object
show all
Includes:
Commands
Defined in:
lib/geet/commandline/configuration.rb

Constant Summary collapse

GIST_CREATE_OPTIONS =

Command options

[
  ['-p', '--public'],
  ['-B', '--no-browse', "Don't open the gist link in the browser after creation"],
  'filename',
  '[description]'
].freeze
ISSUE_CREATE_OPTIONS =
[
  ['-n', '--no-open-issue',                           "Don't open the issue link in the browser after creation"],
  ['-l', '--label-patterns "bug,help wanted"',        'Label patterns'],
  ['-m', '--milestone number_or_pattern',             'Milestone number or description pattern'],
  ['-a', '--assignee-patterns john,tom,adrian,kevin', 'Assignee login patterns. Defaults to authenticated user'],
  ['-u', '--upstream',                                'Create on the upstream repository'],
  'title',
  'description'
].freeze
ISSUE_LIST_OPTIONS =
[
  ['-u', '--upstream',                                'List on the upstream repository'],
].freeze
LABEL_LIST_OPTIONS =
[
].freeze
MILESTONE_LIST_OPTIONS =
[
].freeze
PR_CREATE_OPTIONS =
[
  ['-n', '--no-open-pr',                              "Don't open the PR link in the browser after creation"],
  ['-l', '--label-patterns "legacy,code review"',     'Label patterns'],
  ['-m', '--milestone number_or_pattern',             'Milestone number or description pattern'],
  ['-r', '--reviewer-patterns john,tom,adrian,kevin', 'Reviewer login patterns'],
  ['-u', '--upstream',                                'Create on the upstream repository'],
  'title',
  'description'
].freeze
PR_LIST_OPTIONS =
[
  ['-u', '--upstream',                                'List on the upstream repository'],
].freeze
PR_MERGE_OPTIONS =

rubocop:disable Style/MutableConstant

[
  long_help: 'Merge the PR for the current branch'
]

Constants included from Commands

Geet::Commandline::Commands::GIST_CREATE_COMMAND, Geet::Commandline::Commands::ISSUE_CREATE_COMMAND, Geet::Commandline::Commands::ISSUE_LIST_COMMAND, Geet::Commandline::Commands::LABEL_LIST_COMMAND, Geet::Commandline::Commands::MILESTONE_LIST_COMMAND, Geet::Commandline::Commands::PR_CREATE_COMMAND, Geet::Commandline::Commands::PR_LIST_COMMAND, Geet::Commandline::Commands::PR_MERGE_COMMAND

Instance Method Summary collapse

Instance Method Details

#api_tokenObject



84
85
86
# File 'lib/geet/commandline/configuration.rb', line 84

def api_token
  ENV['GITHUB_API_TOKEN'] || raise('Missing $GITHUB_API_TOKEN')
end

#decode_argvObject

Public interface



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/geet/commandline/configuration.rb', line 61

def decode_argv
  SimpleScripting::Argv.decode(
    'gist' => {
      'create' => GIST_CREATE_OPTIONS,
    },
    'issue' => {
      'create' => ISSUE_CREATE_OPTIONS,
      'list' => ISSUE_LIST_OPTIONS,
    },
    'label' => {
      'list' => LABEL_LIST_OPTIONS,
    },
    'milestone' => {
      'list' => MILESTONE_LIST_OPTIONS,
    },
    'pr' => {
      'create' => PR_CREATE_OPTIONS,
      'list' => PR_LIST_OPTIONS,
      'merge' => PR_MERGE_OPTIONS,
    },
  )
end