File tree Expand file tree Collapse file tree 4 files changed +37
-20
lines changed Expand file tree Collapse file tree 4 files changed +37
-20
lines changed Original file line number Diff line number Diff line change @@ -77,11 +77,14 @@ def command_help_data
7777
7878 public_commands . each do |command |
7979 result [ command . group_string ] ||= { }
80- result [ command . group_string ] [ command . name ] = command . summary_string
80+ result [ command . group_string ] [ command . name ] = { summary : command . summary_string }
8181 next unless command . expose
8282
8383 command . public_commands . each do |subcommand |
84- result [ command . group_string ] [ "#{ command . name } #{ subcommand . name } " ] = subcommand . summary_string
84+ result [ command . group_string ] [ "#{ command . name } #{ subcommand . name } " ] = {
85+ summary : subcommand . summary_string ,
86+ extended : true
87+ }
8588 end
8689 end
8790
Original file line number Diff line number Diff line change 22% maxlen = command_help_data.values.map(&:keys).flatten.map(&:size).max
33% command_help_data.each do |group, commands|
44printf "<%= group %> \n"
5- % commands.each do |command, summary|
6- echo " <%= command.ljust maxlen %> <%= summary %> "
5+ % commands.each do |command, info|
6+ % if info[:extended]
7+ [[ -n $long_usage ]] && echo " <%= command.ljust maxlen %> <%= info[:summary] %> "
8+ % else
9+ echo " <%= command.ljust maxlen %> <%= info[:summary] %> "
10+ % end
711% end
812echo
913% end
Original file line number Diff line number Diff line change @@ -21,16 +21,10 @@ Usage:
2121Commands:
2222 init Start a new project
2323 config Config management commands
24- config edit Edit config file
25- config show Show config file
2624
2725Cluster Commands:
2826 server Server management commands
29- server start Start the server
30- server stop Stop the server
3127 container Container management commands
32- container exec Run a command in the container
33- container down Terminate a container
3428
3529+ ./cli -h
3630cli
Original file line number Diff line number Diff line change 11---
22'Commands:':
3- init: Start a new project
4- config: Config management commands
5- config edit: Edit config file
6- config show: Show config file
3+ init:
4+ :summary: Start a new project
5+ config:
6+ :summary: Config management commands
7+ config edit:
8+ :summary: Edit config file
9+ :extended: true
10+ config show:
11+ :summary: Show config file
12+ :extended: true
713'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
14+ server:
15+ :summary: Server management commands
16+ server start:
17+ :summary: Start the server
18+ :extended: true
19+ server stop:
20+ :summary: Stop the server
21+ :extended: true
22+ container:
23+ :summary: Container management commands
24+ container exec:
25+ :summary: Run a command in the container
26+ :extended: true
27+ container down:
28+ :summary: Terminate a container
29+ :extended: true
You can’t perform that action at this time.
0 commit comments