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") { @options[:all] = true } @parser.on("-r", "--remotes") { @options[:remotes] = true } @options[:verbose] = 0 @parser.on("-v", "--verbose") { @options[:verbose] += 1 } @parser.on("-d", "--delete") { @options[:delete] = true } @parser.on("-f", "--force") { @options[:force] = true } @parser.on "-D" do @options[:delete] = @options[:force] = true end @parser.on "-u <upstream>", "--set-upstream-to=<upstream>" do |upstream| @options[:upstream] = upstream end @parser.on("-t", "--track") { @options[:track] = true } @parser.on("--unset-upstream") { @options[: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 @options[:upstream] set_upstream_branch elsif @options[:delete] delete_branches elsif @args.empty? list_branches else create_branch end exit 0 end |