Last active
August 29, 2015 14:01
-
-
Save ishikawa84g/c5628dd6c2a607db41c6 to your computer and use it in GitHub Desktop.
Nova config一覧作成用(Juno)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- generator.py.org 2014-12-08 09:54:27.803765216 +0900 | |
+++ generator.py 2014-12-08 09:46:15.079748119 +0900 | |
@@ -45,13 +45,12 @@ | |
MULTISTROPT = "MultiStrOpt" | |
OPT_TYPES = { | |
- STROPT: 'string value', | |
- BOOLOPT: 'boolean value', | |
- INTOPT: 'integer value', | |
- FLOATOPT: 'floating point value', | |
- LISTOPT: 'list value', | |
- DICTOPT: 'dict value', | |
- MULTISTROPT: 'multi valued', | |
+ STROPT: 'StrOpt', | |
+ BOOLOPT: 'BoolOpt', | |
+ INTOPT: 'IntOpt', | |
+ FLOATOPT: 'FloatOpt', | |
+ LISTOPT: 'ListOpt', | |
+ MULTISTROPT: 'MultiStrOpt', | |
} | |
OPTION_REGEX = re.compile(r"(%s)" % "|".join([STROPT, BOOLOPT, INTOPT, | |
@@ -201,10 +200,7 @@ | |
print("[%s]" % group) | |
print('') | |
for mod, opts in opts_by_module: | |
- print('#') | |
- print('# Options defined in %s' % mod) | |
- print('#') | |
- print('') | |
+ print('### %s' % mod) | |
for opt in opts: | |
_print_opt(opt) | |
print('') | |
@@ -252,9 +248,7 @@ | |
except (ValueError, AttributeError) as err: | |
sys.stderr.write("%s\n" % str(err)) | |
sys.exit(1) | |
- opt_help = u'%s (%s)' % (opt_help, | |
- OPT_TYPES[opt_type]) | |
- print('#', "\n# ".join(textwrap.wrap(opt_help, WORDWRAP_WIDTH))) | |
+ print('%s' % OPT_TYPES[opt_type]) | |
if opt.deprecated_opts: | |
for deprecated_opt in opt.deprecated_opts: | |
if deprecated_opt.name: | |
@@ -265,35 +259,36 @@ | |
deprecated_opt.name)) | |
try: | |
if opt_default is None: | |
- print('#%s=<None>' % opt_name) | |
+ print('#%s_=_<None>' % opt_name) | |
elif opt_type == STROPT: | |
assert(isinstance(opt_default, six.string_types)) | |
- print('#%s=%s' % (opt_name, _sanitize_default(opt_name, | |
+ print('#%s_=_%s' % (opt_name, _sanitize_default(opt_name, | |
opt_default))) | |
elif opt_type == BOOLOPT: | |
assert(isinstance(opt_default, bool)) | |
- print('#%s=%s' % (opt_name, str(opt_default).lower())) | |
+ print('#%s_=_%s' % (opt_name, str(opt_default).lower())) | |
elif opt_type == INTOPT: | |
assert(isinstance(opt_default, int) and | |
not isinstance(opt_default, bool)) | |
- print('#%s=%s' % (opt_name, opt_default)) | |
+ print('#%s_=_%s' % (opt_name, opt_default)) | |
elif opt_type == FLOATOPT: | |
assert(isinstance(opt_default, float)) | |
- print('#%s=%s' % (opt_name, opt_default)) | |
+ print('#%s_=_%s' % (opt_name, opt_default)) | |
elif opt_type == LISTOPT: | |
assert(isinstance(opt_default, list)) | |
- print('#%s=%s' % (opt_name, ','.join(opt_default))) | |
+ print('#%s_=_%s' % (opt_name, ','.join(opt_default))) | |
elif opt_type == DICTOPT: | |
assert(isinstance(opt_default, dict)) | |
opt_default_strlist = [str(key) + ':' + str(value) | |
for (key, value) in opt_default.items()] | |
- print('#%s=%s' % (opt_name, ','.join(opt_default_strlist))) | |
+ print('#%s_=_%s' % (opt_name, ','.join(opt_default_strlist))) | |
elif opt_type == MULTISTROPT: | |
assert(isinstance(opt_default, list)) | |
if not opt_default: | |
opt_default = [''] | |
for default in opt_default: | |
- print('#%s=%s' % (opt_name, default)) | |
+ print('#%s_=_%s' % (opt_name, default)) | |
+ print('## %s' % opt_help) | |
print('') | |
except Exception: | |
sys.stderr.write('Error in option "%s"\n' % opt_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment