Class: Inch::CLI::Command::Options::Diff
Instance Attribute Summary
Attributes inherited from BaseObject
#object
Attributes inherited from BaseList
#objects
Attributes inherited from Base
#codebase
Instance Method Summary
collapse
#git, #sh
Methods inherited from BaseObject
#prepare_objects
Methods inherited from BaseList
#prepare_codebase
Methods inherited from Base
#description, #name, register_command_as, run, #run, #usage
#ui
Constructor Details
#initialize ⇒ Diff
Returns a new instance of Diff.
10
11
12
13
|
# File 'lib/inch/cli/command/options/diff.rb', line 10
def initialize
@before_rev = "HEAD"
@after_rev = nil
end
|
Instance Method Details
#descriptions ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/inch/cli/command/options/diff.rb', line 15
def descriptions
[
"",
"Shows changes in documentation between two revisions " \
"(defaults to last commit against current)",
"",
"Example: " + "$ inch diff HEAD^..HEAD".cyan,
"",
description_hint_grades,
description_hint_arrows
]
end
|
#revisions ⇒ Array<String>
Returns the revisions to be diffed nil meaning the current working dir, including untracked files since these are later parsed via ‘git rev-parse`, we can support notations like “HEAD” or “HEAD^^”.
40
41
42
43
44
45
46
|
# File 'lib/inch/cli/command/options/diff.rb', line 40
def revisions
if object_names.empty?
[@before_rev, @after_rev]
else
object_names.first.split("..")
end
end
|
#set_options(opts) ⇒ Object
28
29
30
31
|
# File 'lib/inch/cli/command/options/diff.rb', line 28
def set_options(opts)
diff_options(opts)
common_options(opts)
end
|
#since_last_commit? ⇒ Boolean
48
49
50
|
# File 'lib/inch/cli/command/options/diff.rb', line 48
def since_last_commit?
revisions == ["HEAD", nil]
end
|
#since_last_push? ⇒ Boolean
52
53
54
|
# File 'lib/inch/cli/command/options/diff.rb', line 52
def since_last_push?
@since_last_push == true
end
|