-
-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optionally support long_description in CLI #428
Comments
Hi! I am trying to get the docstrings from my functions called by For example: def encrypt_main(path_to_sacc: Path_fr,
path_to_save: Path_fr = None,
keep_original: bool = False) -> None:
"""
Main function to encrypt a SACC file from the command line.
[!] WARNING: BY DEFAULT, IT DELETES THE ORIGINAL SACC FILE. [!]
use the flag --keep_original true to keep the original file.
""" then later I have: def main():
CLI({"datavector": datavector_main,
"encrypt": encrypt_main,
},) and if I call: mypackage encrypt --help I only get the following:
Is there a way to force printing more than a single line? |
I have a few ideas to make the help of Adding an For the time being, you could patch parse_docstring. For example in your case: import jsonargparse._optionals
parse_docstring_original = jsonargparse._optionals.parse_docstring
def parse_docstring(component, params=False, logger=None):
result = parse_docstring_original(component, params, logger)
if result and getattr(component, "__name__", None) == "encrypt_main":
result.short_description += " " + result.long_description.split("\n")[0]
return result
jsonargparse._optionals.parse_docstring = parse_docstring Do note that the |
🚀 Feature request
Currently, CLI() uses short_description from the parsed docstring
I would like an option to include the long description in the help string.
Motivation
Sometimes there is useful content in the long description which is hidden from the user unless they read the script, or the writer explicitly breaks out that into a help string and sidesteps the docstring parsing functionality, making the docstring less useful for a developer.
Pitch
Add an option to CLI() like
include_docstring_long_description
.Alternatives
Use a separate variable and pass it in as
CLI(description=...)
The text was updated successfully, but these errors were encountered: