Class: MergeBranch
Instance Attribute Summary
Attributes inherited from Command
#args, #known_options, #options, #unknown_options
Instance Method Summary collapse
-
#cmd ⇒ Object
Returns a command appropriate for executing at the command line.
- #parser ⇒ Object
Methods inherited from Command
#current_branch, #default_branch, #initialize, #origin_url, #parse, #protocol, run!, #run!, #service
Constructor Details
This class inherits a constructor from Command
Instance Method Details
#cmd ⇒ Object
Returns a command appropriate for executing at the command line. For example:
git checkout master
git merge --no-ff --log <branch>
18 19 20 21 22 23 24 25 |
# File 'lib/git-utils/merge_branch.rb', line 18 def cmd lines = ["git checkout #{target_branch}"] c = ["git merge --no-ff --log"] c << argument_string() unless .empty? c << current_branch lines << c.join(' ') lines.join("\n") end |
#parser ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/git-utils/merge_branch.rb', line 5 def parser OptionParser.new do |opts| opts. = "Usage: git merge-into-branch [branch] [options]" opts.on_tail("-h", "--help", "this usage guide") do puts opts.to_s; exit 0 end end end |