diff options
author | Toshio Kuratomi <a.badger@gmail.com> | 2019-07-17 12:01:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-17 12:01:07 -0700 |
commit | 5392d8697d645b23f1abb56a125f4b399fef8d7a (patch) | |
tree | fc83d25ca55fc459925ecaebe69a2f46c4420a58 /hacking/build_library | |
parent | c2253c8133e6b0e97c456ef38ad27b13d65fac4d (diff) | |
download | ansible-5392d8697d645b23f1abb56a125f4b399fef8d7a.tar.gz |
Docs scripts cleanup (#59169)
* Fix dump_keywords to require attribute docs
* Change the documentation commands to make definition files positional
Since the definition files are mandatory, make them positional
parameters instead of options.
Diffstat (limited to 'hacking/build_library')
-rw-r--r-- | hacking/build_library/build_ansible/command_plugins/dump_config.py | 12 | ||||
-rw-r--r-- | hacking/build_library/build_ansible/command_plugins/dump_keywords.py | 10 |
2 files changed, 7 insertions, 15 deletions
diff --git a/hacking/build_library/build_ansible/command_plugins/dump_config.py b/hacking/build_library/build_ansible/command_plugins/dump_config.py index 51db0f2a99..d1822d20e8 100644 --- a/hacking/build_library/build_ansible/command_plugins/dump_config.py +++ b/hacking/build_library/build_ansible/command_plugins/dump_config.py @@ -50,8 +50,8 @@ class DocumentConfig(Command): help="directory containing Jinja2 templates") parser.add_argument("-o", "--output-dir", action="store", dest="output_dir", default='/tmp/', help="Output directory for rst files") - parser.add_argument("-d", "--docs-source", action="store", dest="docs", default=None, - help="Source for attribute docs") + parser.add_argument("config_defs", metavar="CONFIG-OPTION-DEFINITIONS.yml", type=str, + help="Source for config option docs") @staticmethod def main(args): @@ -60,13 +60,9 @@ class DocumentConfig(Command): template_file = os.path.basename(template_file_full_path) template_dir = os.path.dirname(template_file_full_path) - if args.docs: - with open(args.docs) as f: - docs = yaml.safe_load(f) - else: - docs = {} + with open(args.config_defs) as f: + config_options = yaml.safe_load(f) - config_options = docs config_options = fix_description(config_options) env = Environment(loader=FileSystemLoader(template_dir), trim_blocks=True,) diff --git a/hacking/build_library/build_ansible/command_plugins/dump_keywords.py b/hacking/build_library/build_ansible/command_plugins/dump_keywords.py index ff1d52d33c..2fc6e5d259 100644 --- a/hacking/build_library/build_ansible/command_plugins/dump_keywords.py +++ b/hacking/build_library/build_ansible/command_plugins/dump_keywords.py @@ -106,16 +106,12 @@ class DocumentKeywords(Command): help="directory containing Jinja2 templates") parser.add_argument("-o", "--output-dir", action="store", dest="output_dir", default='/tmp/', help="Output directory for rst files") - parser.add_argument("-d", "--docs-source", action="store", dest="docs", default=None, - help="Source for attribute docs") + parser.add_argument("keyword_defs", metavar="KEYWORD-DEFINITIONS.yml", type=str, + help="Source for playbook keyword docs") @staticmethod def main(args): - if not args.docs: - print('Definitions for keywords must be specified via `--docs-source FILENAME`') - return 1 - - keyword_definitions = load_definitions(args.docs) + keyword_definitions = load_definitions(args.keyword_defs) pb_keywords = extract_keywords(keyword_definitions) keyword_page = generate_page(pb_keywords, args.template_dir) |