Skip to content

Commit 1efb2a6

Browse files
committed
- Rename command.deep_help to command.expose
1 parent 5690c4a commit 1efb2a6

File tree

12 files changed

+115
-23
lines changed

12 files changed

+115
-23
lines changed

examples/command-groups/README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,11 @@ Usage:
7070
7171
File Commands:
7272
download Download a file
73-
74-
Commands:
7573
upload Upload a file
76-
logout Delete login credentials to the config file
7774
7875
Login Commands:
7976
login Write login credentials to the config file
77+
logout Delete login credentials to the config file
8078
8179
8280
@@ -94,13 +92,11 @@ Usage:
9492
9593
File Commands:
9694
download Download a file
97-
98-
Commands:
9995
upload Upload a file
100-
logout Delete login credentials to the config file
10196
10297
Login Commands:
10398
login Write login credentials to the config file
99+
logout Delete login credentials to the config file
104100
105101
Options:
106102
--help, -h
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Commands Deep Help Example
1+
# Commands Expose Example
22

33
Demonstrates how to show the summary help of subcommands in the `--help`
44
message of their parent command.
@@ -25,10 +25,10 @@ commands:
2525
- name: config
2626
help: Config management commands
2727

28-
# Setting `deep_help` to true will show the summary of the commands when
29-
# running the help for this command. In this case, `config edit` and
28+
# Setting `expose` to true will show the summary of the subcommands when
29+
# running the help for the parent command. In this case, `config edit` and
3030
# `config show` will be displayed when running `cli --help`.
31-
deep_help: true
31+
expose: true
3232
commands:
3333
- name: edit
3434
help: Edit config file
@@ -38,9 +38,11 @@ commands:
3838
- name: server
3939
help: Server management commands
4040

41-
# Adding a `group` works well with `deep_help`.
42-
deep_help: true
41+
# Adding a `group` works well with `expose`. In this case, `server start` and
42+
# `server stop` will be listed under `Cluster Commands`.
43+
expose: true
4344
group: Cluster
45+
4446
commands:
4547
- name: start
4648
help: Start the server
@@ -50,7 +52,7 @@ commands:
5052
- name: container
5153
alias: c
5254
help: Container management commands
53-
deep_help: true
55+
expose: true
5456
group: Cluster
5557
commands:
5658
- name: exec

examples/commands-deep-help/src/bashly.yml renamed to examples/commands-expose/src/bashly.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ commands:
77
- name: config
88
help: Config management commands
99

10-
# Setting `deep_help` to true will show the summary of the commands when
11-
# running the help for this command. In this case, `config edit` and
10+
# Setting `expose` to true will show the summary of the subcommands when
11+
# running the help for the parent command. In this case, `config edit` and
1212
# `config show` will be displayed when running `cli --help`.
13-
deep_help: true
13+
expose: true
1414
commands:
1515
- name: edit
1616
help: Edit config file
@@ -20,9 +20,11 @@ commands:
2020
- name: server
2121
help: Server management commands
2222

23-
# Adding a `group` works well with `deep_help`.
24-
deep_help: true
23+
# Adding a `group` works well with `expose`. In this case, `server start` and
24+
# `server stop` will be listed under `Cluster Commands`.
25+
expose: true
2526
group: Cluster
27+
2628
commands:
2729
- name: start
2830
help: Start the server
@@ -32,11 +34,10 @@ commands:
3234
- name: container
3335
alias: c
3436
help: Container management commands
35-
deep_help: true
37+
expose: true
3638
group: Cluster
3739
commands:
3840
- name: exec
3941
help: Run a command in the container
4042
- name: down
4143
help: Terminate a container
42-

lib/bashly/concerns/command_scopes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def command_help_data
2323
public_commands.each do |command|
2424
result[command.group_string] ||= {}
2525
result[command.group_string][command.name] = command.summary_string
26-
next unless command.deep_help
26+
next unless command.expose
2727

2828
command.public_commands.each do |subcommand|
2929
result[command.group_string]["#{command.name} #{subcommand.name}"] = subcommand.summary_string

lib/bashly/script/command.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ class << self
88
def option_keys
99
@option_keys ||= %i[
1010
alias args catch_all commands completions
11-
deep_help default dependencies environment_variables examples
12-
extensible filename filters flags
11+
default dependencies environment_variables examples
12+
extensible expose filename filters flags
1313
footer group help name
1414
private version
1515
short
File renamed without changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'Commands:':
3+
init: Start a new project
4+
config: Config management commands
5+
config edit: Edit config file
6+
config show: Show config file
7+
'Cluster Commands:':
8+
server: Server management commands
9+
server start: Start the server
10+
server stop: Stop the server
11+
container: Container management commands
12+
container exec: Run a command in the container
13+
container down: Terminate a container

spec/bashly/message_strings_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
cp config_template, userspace
1717
end
1818

19+
after do
20+
reset_tmp_dir
21+
end
22+
1923
it "returns values from the user config, falling back to defaults" do
2024
expect(subject[:usage]).to eq "== Usage ==\\n"
2125
end

0 commit comments

Comments
 (0)