Class: Command::Branch
- Includes:
- FastForward
- Defined in:
- lib/command/branch.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods included from FastForward
#fast_forward?, #fast_forward_error
Methods inherited from Base
Constructor Details
This class inherits a constructor from Command::Base
Instance Method Details
#define_options ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/command/branch.rb', line 10 def @parser.on("-a", "--all") { [:all] = true } @parser.on("-r", "--remotes") { [:remotes] = true } [:verbose] = 0 @parser.on("-v", "--verbose") { [:verbose] += 1 } @parser.on("-d", "--delete") { [:delete] = true } @parser.on("-f", "--force") { [:force] = true } @parser.on "-D" do [:delete] = [:force] = true end @parser.on "-u <upstream>", "--set-upstream-to=<upstream>" do |upstream| [:upstream] = upstream end @parser.on("-t", "--track") { [:track] = true } @parser.on("--unset-upstream") { [:upstream] = :unset } end |
#run ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/command/branch.rb', line 32 def run if [:upstream] set_upstream_branch elsif [:delete] delete_branches elsif @args.empty? list_branches else create_branch end exit 0 end |