Class: Leg::Commands::Status
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/status.rb', line 4
def self.name
"status"
end
|
.summary ⇒ Object
8
9
10
|
# File 'lib/leg/commands/status.rb', line 8
def self.summary
"Show unsaved changes and the state of the step/ folder."
end
|
.usage ⇒ Object
12
13
14
|
# File 'lib/leg/commands/status.rb', line 12
def self.usage
""
end
|
Instance Method Details
#run ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/leg/commands/status.rb', line 19
def run
needs! :config, :repo
state = @git.state
case state.operation
when nil
if state.step_number.nil?
output "Nothing to report.\n"
else
output "Step #{state.step_number} checked out into step/.\n"
end
when :commit
if state.args[1]
output "Amended step #{state.step_number}. "
end
if state.args[0] > 0
output "Added #{state.args[0]} step#{'s' if state.args[0] != 1} after step #{state.step_number}."
end
output "\n"
else
raise "unknown operation"
end
if state.conflict
output "\n"
output "Currently in a merge conflict. Resolve the conflict in step/ and\n"
output "run `leg resolve` to continue.\n"
elsif !state.operation.nil?
output "\n"
output "The above change(s) have not been saved yet. Run `leg save` to\n"
output "save to the doc/ folder.\n"
end
end
|
#setopts!(o) ⇒ Object
16
17
|
# File 'lib/leg/commands/status.rb', line 16
def setopts!(o)
end
|