docs(CLI): add required scalar arguments

This commit is contained in:
Sebastian Thiel
2015-04-12 18:16:53 +02:00
parent 334061a5e2
commit c65a8a6bdf
3 changed files with 29 additions and 11 deletions

View File

@@ -1,8 +1,8 @@
<%namespace name="util" file="../../lib/util.mako"/>\
<%
from util import (hash_comment, new_context, method_default_scope)
from util import (hash_comment, new_context, method_default_scope, indent_all_but_first_by)
from cli import (subcommand_md_filename, new_method_context, SPLIT_START, SPLIT_END, pretty, SCOPE_FLAG,
mangle_subcommand)
mangle_subcommand, is_request_value_property)
c = new_context(schemas, resources, context.get('methods'))
%>\
@@ -12,7 +12,6 @@
mc = new_method_context(resource, method, c)
%>\
${SPLIT_START} ${subcommand_md_filename(resource, method)}
# ${pretty(resource)}: ${pretty(method)}
% if mc.m.description:
${mc.m.description}
% endif # show method description
@@ -33,6 +32,16 @@ the *${mc.m.scopes[0]}* scope to make a valid call.
If unset, the scope for this method defaults to *${method_default_scope(mc.m)}*.
You can set the scope for this method like this: `${util.program_name()} --${SCOPE_FLAG} <scope> ${mangle_subcommand(resource)} ${mangle_subcommand(method)} ...`
% endif # have method scopes
<%
rprops = [p for p in mc.required_props if not is_request_value_property(mc, p)]
%>\
% if rprops:
# Required Scalar ${len(rprops) > 1 and 'Arguments' or 'Argument'}
% for p in rprops:
* **<${mangle_subcommand(p.name)}\>**
- ${p.get('description') or 'No description provided' | indent_all_but_first_by(2)}
% endfor # each required property (which is not the request value)
% endif # have required properties
${SPLIT_END}
% endfor # each method
% endfor # each resource