Class: Commands::Info
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(*args) ⇒ Info
constructor
A new instance of Info.
- #run! ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(*args) ⇒ Info
Returns a new instance of Info.
5 6 7 8 |
# File 'lib/commands/info.rb', line 5 def initialize(*args) @story_id = args.shift if args.first =~ /^(\d+)$/ super(*args) end |
Instance Method Details
#run! ⇒ Object
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 35 36 37 |
# File 'lib/commands/info.rb', line 10 def run! super unless story_id put "No story id was supplied and you aren't on a topic branch!" return 1 end put "Story: #{story.name}" put "URL: #{story.url}" put "Labels: #{story.labels.split(',').join(', ')}" if story.labels put "State: #{story.accepted_at ? 'accepted' : 'not accepted'}" colwidth = 74 put "\nDescription:\n" put wrap_text("#{story.description}\n", colwidth).gsub(/^/, ' ').chomp if [:comments] put "\nComments:\n" story.notes.all.each do |note| @output.printf " %-37s%37s\n\n", note., note.noted_at.strftime("%b %e, %Y %k:%M%p") put wrap_text(note.text, colwidth - 2).gsub(/^/, ' ') end end return 0 end |