Class: GHI::Commands::Status

Inherits:
Command
  • Object
show all
Defined in:
lib/ghi/commands/status.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

#action, #args, #verbose

Attributes included from Formatting

#paging

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

#executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/ghi/commands/status.rb', line 11

def execute
  begin
    options.parse! args
    @repo ||= ARGV[0] if ARGV.one?
  rescue OptionParser::InvalidOption => e
    fallback.parse! e.args
    retry
  end
  
  require_repo
  res = throb { api.get "/repos/#{repo}" }.body

  if res['has_issues']
    puts "Issues are enabled for this repo"
  else
    puts "Issues are not enabled for this repo"
  end

end

#optionsObject



5
6
7
8
9
# File 'lib/ghi/commands/status.rb', line 5

def options
  OptionParser.new do |opts|
    opts.banner = 'usage: ghi status'
  end
end