Closed OrHayat closed 3 months ago
you can supply the help
when instantiating the subapp.
from cyclopts import App, Parameter
app = App(name="test1")
buildcli = App(name="application1", help="Help string for application1.")
app.command(buildcli)
def main():
app()
if __name__ == "__main__":
main()
$ python issue-207.py
Usage: test1 COMMAND
╭─ Commands ─────────────────────────────────────────────────────╮
│ application1 Help string for application1. │
│ --help,-h Display this message and exit. │
│ --version Display application version. │
╰────────────────────────────────────────────────────────────────╯
Alternatively, if no explicit help string is provided, the docstring from the registered default
function for the subapp will be used:
from cyclopts import App, Parameter
app = App(name="test1")
buildcli = App(name="application1")
app.command(buildcli)
@buildcli.default
def buildcli_default_function():
"""Help string for application1.
You can make the description longer in subsequent lines.
"""
def main():
app()
if __name__ == "__main__":
main()
This results in the same output:
$ python issue-207.py
Usage: test1 COMMAND
╭─ Commands ─────────────────────────────────────────────────────╮
│ application1 Help string for application1. │
│ --help,-h Display this message and exit. │
│ --version Display application version. │
╰────────────────────────────────────────────────────────────────╯
This is documented more in the help section of the docs. The way of specifying help for a subapp in your example is specifically disallowed because it leads to a particularly ambiguous situation.
# Not allowed!
app.command(subapp, help="My Help.")
If the check wasn't in place, this would overwrite the help string in subapp; in some situtations this is fine, in others it is not.
i think thats a bug/missing feature but i might tried to do something wrong
i wanted to add help message to application1
but i get this error