Skip to content
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

Open
indigoviolet opened this issue Dec 28, 2023 · 1 comment
Open

Optionally support long_description in CLI #428

indigoviolet opened this issue Dec 28, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@indigoviolet
Copy link

🚀 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=...)

@indigoviolet indigoviolet added the enhancement New feature or request label Dec 28, 2023
@arthurmloureiro
Copy link

Hi!
Just to add that I am also finding the need for something like this.

I am trying to get the docstrings from my functions called by CLI to print more than a single line of the docstring but cannot find a proper way of doing it. I need to print a warning for the user which appears in the second line of my docstring (the first is the description) and currently the only way of doing it is having a massive line with a \n in it. This messes up pep8 completely for me...

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:

Main function to encrypt a SACC file from the command line.

Is there a way to force printing more than a single line?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants