Start of category flag support

This adds what I think needs to be done to support categories for flags
but we will see if that works. It also forces the scripts to use python2
since they blow up under python3 which is becoming the default python on
many linux systems.

Small fix to app_test as well so it conforms to the new Flag interface.
This commit is contained in:
Michael Schuett
2019-01-27 01:41:06 -05:00
parent b67dcf995b
commit ff1c0b58dd
6 changed files with 136 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python2
"""
The flag types that ship with the cli library have many things in common, and
so we can take advantage of the `go generate` command to create much of the
@@ -144,6 +144,7 @@ def _write_cli_flag_types(outfile, types):
EnvVar string
FilePath string
Hidden bool
Category string
""".format(**typedef))
if typedef['value']:
@@ -170,6 +171,11 @@ def _write_cli_flag_types(outfile, types):
return f.Name
}}
// GetHidden lets us know if the flag is hidden or not
func (f {name}Flag) GetHidden() bool {{
return f.Hidden
}}
// {name} looks up the value of a local {name}Flag, returns
// {context_default} if not found
func (c *Context) {name}(name string) {context_type} {{