Class: Ptb::CLI
- Inherits:
-
Thor
- Object
- Thor
- Ptb::CLI
- Defined in:
- lib/ptb/cli.rb
Instance Method Summary collapse
- #branch ⇒ Object
-
#initialize ⇒ CLI
constructor
A new instance of CLI.
- #message ⇒ Object
Constructor Details
#initialize ⇒ CLI
Returns a new instance of CLI.
3 4 5 6 7 8 9 |
# File 'lib/ptb/cli.rb', line 3 def initialize(*) super Signal.trap("SIGINT") do exit! end end |
Instance Method Details
#branch ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/ptb/cli.rb', line 14 def branch branches=`git branch` branches.each_line do |line| branch = line[2..-2] if branch =~ /^[0-9]+$/ if story = project.stories.find(branch) say "#{line.rstrip} [#{story.current_state}] #{story.name} (#{story.url})" else say line.rstrip end else say line.rstrip end end end |
#message ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ptb/cli.rb', line 33 def branch = `git symbolic-ref --short HEAD`.strip if branch =~ /^[0-9]+$/ if story = project.stories.find(branch) puts <<-EOS [##{branch}] #{word_wrap(story.name, :line_width => 72)} #{story.url} EOS end end end |