diff --git a/HISTORY.rst b/HISTORY.rst index b9ca0d856..713faa95e 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -5,9 +5,15 @@ History ======= -current - 2018-12-09 - 0.00Mb +current - 2018-12-10 - 0.00Mb ============================= +* `213`: removes cmdref from documentation when creating a parser for a function (2018-12-10) +* `212`: issue when the default value is None when building the parser for a specific function (2018-12-09) + +1.8.2884 - 2018-12-09 - 2.03Mb +============================== + * `211`: automatically git tag when publishing (2018-12-05) * `210`: add __main__ command line (2018-11-29) diff --git a/src/pyquickhelper/cli/cli_helper.py b/src/pyquickhelper/cli/cli_helper.py index 8b0fd65de..1ecf846c2 100644 --- a/src/pyquickhelper/cli/cli_helper.py +++ b/src/pyquickhelper/cli/cli_helper.py @@ -19,8 +19,12 @@ def clean_documentation_for_cli(doc, cleandoc): @param cleandoc a string which tells how to clean, or a function which takes a function and returns a string + + The function removes everything after ``.. cmdref::`` and ``.. cmdreflist`` + as it creates an infinite loop of processus if this command + is part of the documentation of the command line itself. """ - for st in ('.. versionchanged::', '.. versionadded'): + for st in ('.. versionchanged::', '.. versionadded::', '.. cmdref::', '.. cmdreflist::'): if st in doc: doc = doc.split(st)[0] if isinstance(cleandoc, (list, tuple)): @@ -64,7 +68,7 @@ def create_cli_parser(f, prog=None, layout="sphinx", skip_parameters=('fLOG',), richer requires :epkg:`sphinx` @param skip_parameters do not expose these parameters @param cleandoc cleans the documentation before converting it into text, - see @fn clean_documentation_for_cli + @see fn clean_documentation_for_cli @param options additional :epkg:`Sphinx` options @return :epkg:`*py:argparse:ArgumentParser` @@ -198,7 +202,7 @@ def call_cli_function(f, args=None, parser=None, fLOG=print, skip_parameters=('f @param fLOG logging function @param skip_parameters see @see fn create_cli_parser @param cleandoc cleans the documentation before converting it into text, - see @fn clean_documentation_for_cli + @see fn clean_documentation_for_cli @param options additional :epkg:`Sphinx` options This function is used in command line @see fn pyq_sync. @@ -333,6 +337,8 @@ def main(args, fLOG=print): .. cmdref:: :title: Clean files :cmd: -m pyquickhelper clean_files --help + + The command line cleans files in a folder. """ if fLOG is None: raise ValueError("fLOG must be defined.") diff --git a/src/pyquickhelper/sphinxext/sphinx_cmdref_extension.py b/src/pyquickhelper/sphinxext/sphinx_cmdref_extension.py index d6c8e549c..7c3aa3277 100644 --- a/src/pyquickhelper/sphinxext/sphinx_cmdref_extension.py +++ b/src/pyquickhelper/sphinxext/sphinx_cmdref_extension.py @@ -138,7 +138,6 @@ def run(self): fullname = fullname.strip() name_cmd = name_cmd.strip() - # fullname = "{0}.{1}".format(fullname, name_fct) try: obj, name = import_object(fullname, kind="function")