Skip to content

Commit 4fa4482

Browse files
authored
Merge pull request #58 from hlship/hls/20251028-command-path-in-group-help
Include the tool name in group help
2 parents 36e9b68 + 23127dd commit 4fa4482

15 files changed

+42
-25
lines changed

src/net/lewisship/cli_tools/impl.clj

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@
2929
(defn- compose-command-path
3030
[tool-name command-path]
3131
(when tool-name
32-
[:bold.green
33-
tool-name
34-
(when (seq command-path)
35-
(list
36-
" "
37-
(string/join " " command-path)))]))
32+
(list
33+
[(style :tool-name) tool-name]
34+
(when (seq command-path)
35+
(list " "
36+
[(style :command-path)
37+
(string/join " " command-path)])))))
3838

3939
(defn command-path
4040
[]
@@ -751,7 +751,8 @@
751751
(reduce max 0)))]
752752
(when container-map
753753
(pout (when recurse? "\n")
754-
[(style :command) (string/join " " (:command-path container-map))]
754+
(compose-command-path (:tool-name *tool-options*)
755+
(:command-path container-map))
755756
" - "
756757
(or (some-> container-map :group-doc cleanup-docstring)
757758
(missing-doc))))

test-resources/excess-values.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Error in harness collect: Unexpected argument 'the-extra'
1+
Error in harness collect: Unexpected argument 'the-extra'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
group-test: group nested is incomplete; butterfly or leaf could follow; use group-test group nested --help (or -h) to list commands
1+
group-test: group nested is incomplete; butterfly or leaf could follow; use group-test group nested --help (or -h) to list commands

test-resources/help-incomplete.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
group-test: group is incomplete; echo, edit, or nested could follow; use group-test group --help (or -h) to list commands
1+
group-test: group is incomplete; echo, edit, or nested could follow; use group-test group --help (or -h) to list commands
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Error in harness collect: No value for required argument VAL
1+
Error in harness collect: No value for required argument VAL

test-resources/let-directive.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Error in harness set-mode: Failed to validate "-m unknown": Must be one of async, batch, real-time
1+
Error in harness set-mode: Failed to validate "-m unknown": Must be one of async, batch, real-time

test-resources/messy-full-help.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Commands:
1010
messy: Messy command
1111
simple: Simple command
1212

13-
messy - Messy command and group at same time
13+
bigmess messy - Messy command and group at same time
1414

1515
Commands:
1616
nested: Command nested under messy group/command
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Error in harness configure: HOST: must be a URL
1+
Error in harness configure: HOST: must be a URL

test-resources/sub-group-help.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
group - Grouped commands
1+
group-test group - Grouped commands
22

33
Commands:
44
echo: Echo a string

test-resources/tool-help-group-full.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Commands:
99
group: This provides the default documentation for the entire group
1010
help: List available commands
1111

12-
group - This provides the default documentation for the entire group.
12+
test-harness group - This provides the default documentation for the entire group.
1313

1414
The full doc may span multiple lines.
1515

0 commit comments

Comments
 (0)