Class: Jirify::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/jirify.rb,
lib/jirify/cli/issue.rb,
lib/jirify/cli/setup.rb,
lib/jirify/cli/sprint.rb

Instance Method Summary collapse

Instance Method Details

#mineObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/jirify/cli/issue.rb', line 11

def mine
  if options[:status]
    statuses = [options[:status]]
  else
    statuses = []
    statuses << "To Do" if options[:todo]
    statuses << "In Progress" if options[:in_progress]
    statuses << "In Review" if options[:in_review]
    statuses << "Closed" if options[:closed]
  end

  Jirify::Issues.mine(options[:verbose], statuses, options[:all])
end

#setupObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/jirify/cli/setup.rb', line 4

def setup
  say "Welcome! This will guide you through the configuration of the jirify CLI tool."

  if Config.initialized?
    puts
    reconfigure = yes? "You seem to have already configured jirify.\n" \
      "Do you want to continue and overwrite the current configuration? [Y/N]"
    exit(0) unless reconfigure
  end

  username      = ask "Enter username:"
  token         = ask "Enter token (generate from https://id.atlassian.com):"
  site          = ask "Enter JIRA url:"
  project       = ask "Enter JIRA Project key:"
  filter_labels = ask "Enter a comma-separated list of labels to filter by every time (optional):"

  labels = filter_labels.split ', ' if filter_labels

  options = {
    'options' => {
      'username'         => username,
      'token'            => token,
      'site'             => site,
      'project'          => project,
    }
  }

  options['options']['filter_by_labels'] = labels unless labels.empty?

  Config.write(options)
end

#sprintObject



6
7
8
# File 'lib/jirify/cli/sprint.rb', line 6

def sprint
  Jirify::Sprint.current(options[:verbose], options[:columns], options[:mine])
end