Skip to content

Commit 153324e

Browse files
committed
fix(CLI): 'about()' text for main commands
It shows up in the help, and makes it easier to navigate the command tree without bringing up the html documentation. Fixes #95 [skip ci]
1 parent 94c821e commit 153324e

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

src/mako/cli/lib/argparse.mako

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<%!
33
import os
44
5-
from util import (put_and, supports_scopes, api_index, indent_by, enclose_in)
5+
from util import (put_and, supports_scopes, api_index, indent_by, enclose_in, put_and)
66
from cli import (mangle_subcommand, new_method_context, PARAM_FLAG, STRUCT_FLAG, UPLOAD_FLAG, OUTPUT_FLAG, VALUE_ARG,
77
CONFIG_DIR, SCOPE_FLAG, is_request_value_property, FIELD_SEP, docopt_mode, FILE_ARG, MIME_ARG, OUT_ARG,
88
CONFIG_DIR_FLAG, KEY_VALUE_ARG, to_docopt_arg, DEBUG_FLAG, DEBUG_AUTH_FLAG, MODE_ARG, SCOPE_ARG,
@@ -132,9 +132,12 @@ Configuration:
132132
%>\
133133
let arg_data = [
134134
% for resource in sorted(c.rta_map.keys()):
135+
<%
136+
methods = sorted(c.rta_map[resource])
137+
%>\
135138
<%block filter="indent_by(4)">\
136-
("${mangle_subcommand(resource)}", vec![
137-
% for method in sorted(c.rta_map[resource]):
139+
("${mangle_subcommand(resource)}", "supported subcommands: ${put_and(["'%s'" % mangle_subcommand(m) for m in methods])}", vec![
140+
% for method in methods:
138141
<%
139142
mc = new_method_context(resource, method, c)
140143
@@ -254,8 +257,8 @@ let mut app = App::new("${util.program_name()}")
254257
% endif
255258
% endfor
256259
257-
for &(main_command_name, ref subcommands) in arg_data.iter() {
258-
let mut mcmd = SubCommand::new(main_command_name);
260+
for &(main_command_name, ref about, ref subcommands) in arg_data.iter() {
261+
let mut mcmd = SubCommand::new(main_command_name).about(about);
259262
260263
for &(sub_command_name, ref desc, ref args) in subcommands {
261264
let mut scmd = SubCommand::new(sub_command_name);

0 commit comments

Comments
 (0)