Open ntjess opened 3 years ago
This isn't currently possible (nor is it on the roadmap).
Can you say a bit more about your use-case?
Sure, I wanted a custom HelpAction
for my application:
All option limits come from files. So i.e. the user created "Color Scheme", "dark", "dark2", and "Default" files for --colorscheme
options.
when python -m s3a --help
is called, I want to populate the available option limits, which is trivial if I have access to the parser object:
# Custom help action simply loops through each directory with loadable files
parser.register("action", "help", S3AHelp)
Otherwise, it is difficult to expose this information to Fire
for printing during help.
(I also ended up using this to trivially append a --version
flag to my parser: parser.add_argument("--version", action="version", version=__version__)
. Otherwise, it would have to be a function keyword to show up through Fire
if I'm not mistaken)
I would love to be able to "capture" the argparse instance— then I could pass it to Gooey ( like I do in https://github.com/twardoch/ezgooey ) and have a minimal-effort GUI in addition to CLI.
I love the power & simplicity of 🔥!
fire
can complete ~90% of the CLI needs for my application. However, the help documentation is only available during runtime in my case. Is there some way of getting access to theargparse
parser from Fire and modifying it as a user? It looks like the overload-able information is available up to this point:https://github.com/google/python-fire/blob/ed44d8b801fc24e40729abef11b2dcbf6588d361/fire/core.py#L129
After which it disappears into the void. I would love to be able to modify this parser by adding runtime information. Bonus points if after doing so, I can give it back to
fire
to call the component trace, etc. 🙂