Class: CommandLine::SubCommands::RebaseCommand
- Inherits:
-
Command
- Object
- Command
- CommandLine::SubCommands::RebaseCommand
show all
- Defined in:
- lib/git/contest/command_line/sub_commands/rebase_command.rb
Instance Attribute Summary
Attributes inherited from Command
#args, #input_stream, #opt_parser, #options, #terminal, #tokens
Instance Method Summary
collapse
Methods inherited from Command
#init
Constructor Details
#initialize(new_args, new_input_stream = STDIN) ⇒ RebaseCommand
Returns a new instance of RebaseCommand.
15
16
17
|
# File 'lib/git/contest/command_line/sub_commands/rebase_command.rb', line 15
def initialize(new_args, new_input_stream = STDIN)
super
end
|
Instance Method Details
#define_options ⇒ Object
19
20
21
22
23
|
# File 'lib/git/contest/command_line/sub_commands/rebase_command.rb', line 19
def define_options
opt_parser.on "-i", "--interactive", "Do an interactive rebase." do
options[:interactive] = true
end
end
|
#run ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/git/contest/command_line/sub_commands/rebase_command.rb', line 29
def run
expand_nameprefix_arg_or_current
puts "Will try to rebase '#{$NAME}'..."
Git.require_clean_working_tree
Git.require_branch $BRANCH
Git.do "checkout -q \"#{$BRANCH}\""
rebase_options = ""
if options[:interactive]
rebase_options += " -i"
end
puts Git.do "rebase #{rebase_options} #{$MASTER}"
end
|
#set_default_options ⇒ Object
25
26
27
|
# File 'lib/git/contest/command_line/sub_commands/rebase_command.rb', line 25
def set_default_options
options[:interactive] = false if options[:interactive].nil?
end
|