python-fire
python-fire copied to clipboard
Help Request - Disable NAME and SYNOPSIS Output
I'm trying to find a way to disable the additional output that the fire library creates that comes after the process completes. It begins with NAME and includes SYNOPSIS. I have no need for this additional output in my scenario as it could potentially cause trouble for another external process that calls this and is examining the stdout for its own processing.
Here's an example of what I'm describing:
M:\Python\Workbench>FireHelpDocumentationExample.py --HowMuchPizza=1
()
NAME
FireHelpDocumentationExample.py --HowMuchPizza=1
SYNOPSIS
FireHelpDocumentationExample.py --HowMuchPizza=1 -
I would expect just:
()
An example of code I put together that was used to create this example is here.
Here are some ideas. Instead of defining a class (IntegrationClass) with your main method in it, just make it a function.
def run(HowMuchPizza, TipAmount=None):
pc = ProcessClass()
pc.orderUp(HowMuchPizza, TipAmount)
def main():
fire.Fire(run)
Or you could even just do this (removing IntegrationClass entirely):
def main():
pc = ProcessClass()
fire.Fire(pc.orderUp)
I'm not exactly sure I fully understand the why behind what is going on when using the offered solution, but the --help does show more, however it still seems to behave erratic in that I'm only seeing one paragraph of the description (Pizza lorem) and the last arg's description is cut off.
I do however now see that the NAME and SYNOPSIS output no longer show in the stdout which was the main concern I had for this ticket. I wish to understand why this happens if possible. Does it have something to do with classes calling classes?
Here is the altered code used as suggested. I see in the previous version if forgot to have the tips in the function documentation.