feat(CLI): did you mean for struct values

* functionality is cursor-aware, and fixes the actual string the user
  passed in. That way, it is made very clear how the suggested value
  is to be used.
* it's a known weakness of the implementation that it operates on a
  flattened list of field names, and thus may make nonsensical
  suggestions.
* added punctuation to all errors

Fixes #67
[skip ci]
This commit is contained in:
Sebastian Thiel
2015-05-02 14:03:35 +02:00
parent d2a4e2ff8b
commit 96415d17ca
6 changed files with 117 additions and 30 deletions

View File

@@ -82,6 +82,10 @@ def new_method_context(resource, method, c):
return MethodContext(m, response_schema, params, request_value, media_params,
required_props, optional_props, part_prop)
# Returns a string representing a string-vector of mangled names
# fields is an iterator
def field_vec(fields):
return "vec![%s]" % ', '.join('"%s"' % mangle_subcommand(f) for f in fields)
def pretty(n):
return ' '.join(s.capitalize() for s in mangle_subcommand(n).split('-'))