diff --git a/md_click/main.py b/md_click/main.py index cdaef4f..dd06113 100644 --- a/md_click/main.py +++ b/md_click/main.py @@ -13,6 +13,9 @@ {usage} ``` +## Arguments +{arguments} + ## Options {options} @@ -56,7 +59,16 @@ def dump_helper(base_command, docs_dir): "help": opt.help, "type": str(opt.type) } - for opt in helpdct.get('params', []) + for opt in helpdct.get('params', []) if isinstance(opt, click.core.Option) + } + arguments = { + arg.name: { + "usage": '\n'.join(arg.opts), + "required": arg.required, + "default": arg.default, + "type": str(arg.type) + } + for arg in helpdct.get('params', []) if isinstance(arg, click.core.Argument) } full_command = f"{str(parent) + ' ' if parent else ''}{str(command.name)}" @@ -65,16 +77,27 @@ def dump_helper(base_command, docs_dir): description=command.help, usage=usage, options="\n".join([ - f"* `{opt_name}`{' (REQUIRED)' if opt.get('required') else ''}: \n" - f" * Type: {opt.get('type')} \n" - f" * Default: `{str(opt.get('default')).lower()}`\n" - f" * Usage: `{opt.get('usage')}`\n" - "\n" - f" {opt.get('help') or ''}\n" - f"\n" + f""" +* `{opt_name}`{' (REQUIRED)' if opt.get('required') else ''}: + * Type: {opt.get('type')} + * Default: `{str(opt.get('default'))}` + * Usage: `{opt.get('usage')}` + + {opt.get('help') or ''} + +""" for opt_name, opt in options.items() ]), - help=helptxt + help=helptxt, + arguments="\n".join([ + f""" +* `{arg_name}`{' (REQUIRED)' if arg.get('required') else ''}: + * Type: {arg.get('type')} + * Default: `{str(arg.get('default'))}` + * Usage: `{arg.get('usage')}` +""" + for arg_name, arg in arguments.items() + ]), ) if not docs_path.exists(): diff --git a/requirements.txt b/requirements.txt index 01fa418..dca9a90 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -click>=7.0.0,<=7.1.2 \ No newline at end of file +click