Skip to content

Commit

Permalink
fix(CLI): 'about()' text for main commands
Browse files Browse the repository at this point in the history
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]
  • Loading branch information
Byron committed Apr 30, 2015
1 parent 94c821e commit 153324e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/mako/cli/lib/argparse.mako
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<%!
import os
from util import (put_and, supports_scopes, api_index, indent_by, enclose_in)
from util import (put_and, supports_scopes, api_index, indent_by, enclose_in, put_and)
from cli import (mangle_subcommand, new_method_context, PARAM_FLAG, STRUCT_FLAG, UPLOAD_FLAG, OUTPUT_FLAG, VALUE_ARG,
CONFIG_DIR, SCOPE_FLAG, is_request_value_property, FIELD_SEP, docopt_mode, FILE_ARG, MIME_ARG, OUT_ARG,
CONFIG_DIR_FLAG, KEY_VALUE_ARG, to_docopt_arg, DEBUG_FLAG, DEBUG_AUTH_FLAG, MODE_ARG, SCOPE_ARG,
Expand Down Expand Up @@ -132,9 +132,12 @@ Configuration:
%>\
let arg_data = [
% for resource in sorted(c.rta_map.keys()):
<%
methods = sorted(c.rta_map[resource])
%>\
<%block filter="indent_by(4)">\
("${mangle_subcommand(resource)}", vec![
% for method in sorted(c.rta_map[resource]):
("${mangle_subcommand(resource)}", "supported subcommands: ${put_and(["'%s'" % mangle_subcommand(m) for m in methods])}", vec![
% for method in methods:
<%
mc = new_method_context(resource, method, c)
Expand Down Expand Up @@ -254,8 +257,8 @@ let mut app = App::new("${util.program_name()}")
% endif
% endfor
for &(main_command_name, ref subcommands) in arg_data.iter() {
let mut mcmd = SubCommand::new(main_command_name);
for &(main_command_name, ref about, ref subcommands) in arg_data.iter() {
let mut mcmd = SubCommand::new(main_command_name).about(about);
for &(sub_command_name, ref desc, ref args) in subcommands {
let mut scmd = SubCommand::new(sub_command_name);
Expand Down

0 comments on commit 153324e

Please sign in to comment.