Class: Leg::Commands::Commit
Instance Attribute Summary
Attributes inherited from BaseCommand
#config, #opts
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from BaseCommand
#git_to_litdiff!, inherited, #initialize, #litdiff_to_git!, #needs!, #output, #parseopts!
Class Method Details
.name ⇒ Object
4
5
6
|
# File 'lib/leg/commands/commit.rb', line 4
def self.name
"commit"
end
|
.summary ⇒ Object
8
9
10
|
# File 'lib/leg/commands/commit.rb', line 8
def self.summary
"Append or insert a new step."
end
|
.usage ⇒ Object
12
13
14
|
# File 'lib/leg/commands/commit.rb', line 12
def self.usage
"[-s]"
end
|
Instance Method Details
#run ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/leg/commands/commit.rb', line 28
def run
needs! :config, :repo
commit_options = {
no_rebase: @opts[:stay],
message: @opts[:message],
use_default_message: @opts[:default_message]
}
if @git.commit!(commit_options)
unless @opts[:stay]
git_to_litdiff!
output "Success!\n"
end
else
output "Looks like you've got a conflict to resolve!\n"
end
end
|
#setopts!(o) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/leg/commands/commit.rb', line 16
def setopts!(o)
o.on("-m", "--message MESSAGE", "Set the step summary to MESSAGE") do |m|
@opts[:message] = m
end
o.on("-d", "--default-message", "Leave the step summary unchanged, or set it to a default if empty") do |d|
@opts[:default_message] = d
end
o.on("-s", "--stay", "Don't resolve rest of steps yet") do |s|
@opts[:stay] = s
end
end
|