Class: Redmine::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/redmine/cli.rb

Overview

Command line interface dispatcher: invoke subcommands based on incoming command line switches.

Instance Method Summary collapse

Constructor Details

#initialize(redmine_client:) ⇒ Cli

Returns a new instance of Cli.



8
9
10
# File 'lib/redmine/cli.rb', line 8

def initialize(redmine_client:)
  @redmine = redmine_client
end

Instance Method Details

#call(arguments) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/redmine/cli.rb', line 12

def call(arguments)
  subcommand, *other_args = arguments
  if subcommand =~ /^\d+$/
    call_issue_command(subcommand, other_args)
  elsif subcommand =~ /^\w/
    call_subcommand(subcommand, other_args)
  else
    option_parser.parse(arguments)
  end
end