Class: GHI::Commands::Assign
- Defined in:
- lib/ghi/commands/assign.rb
Constant Summary
Constants included from Formatting
Formatting::CURSOR, Formatting::THROBBERS
Constants included from Formatting::Colors
Formatting::Colors::ANSI, Formatting::Colors::WEB
Instance Attribute Summary
Attributes inherited from Command
Attributes included from Formatting
Instance Method Summary collapse
Methods inherited from Command
#api, #assigns, execute, #initialize, #repo, #repo=
Methods included from Formatting
#columns, #dimensions, #format_comment, #format_comment_editor, #format_comments_and_events, #format_date, #format_editor, #format_event, #format_event_type, #format_issue, #format_issues, #format_issues_header, #format_labels, #format_markdown, #format_milestone, #format_milestone_editor, #format_milestones, #format_number, #format_state, #format_tag, #format_username, #indent, #page, #paginate?, #paging?, #past_due?, #percent, #puts, #throb, #truncate
Methods included from Formatting::Colors
#bg, #blink, #bright, #colorize?, colorize?, #fg, #highlight, #inverse, #no_color, #to_hex, #underline
Constructor Details
This class inherits a constructor from GHI::Commands::Command
Instance Method Details
#execute ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ghi/commands/assign.rb', line 27 def execute self.action = 'edit' assigns[:args] = [] require_repo extract_issue .parse! args unless assigns.key? :assignee assigns[:assignee] = args.pop || Authorization.username end if assigns.key? :assignee assigns[:assignee].sub! /^@/, '' if assigns[:assignee] assigns[:args].concat( assigns[:assignee] ? %W(-u #{assigns[:assignee]}) : %w(--no-assign) ) end assigns[:args] << issue if issue assigns[:args].concat %W(-- #{repo}) case action when 'list' then List.execute assigns[:args] when 'edit' then Edit.execute assigns[:args] end end |
#options ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ghi/commands/assign.rb', line 4 def OptionParser.new do |opts| opts. = <<EOF usage: ghi assign [options] [<issueno>] or: ghi assign <issueno> <user> or: ghi unassign <issueno> EOF opts.separator '' opts.on( '-u', '--assignee <user>', 'assign to specified user' ) do |assignee| assigns[:assignee] = assignee end opts.on '-d', '--no-assignee', 'unassign this issue' do assigns[:assignee] = nil end opts.on '-l', '--list', 'list assigned issues' do self.action = 'list' end opts.separator '' end end |