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

Help Request - Disable NAME and SYNOPSIS Output #277

Open
Sn3akyP3t3 opened this issue Aug 5, 2020 · 2 comments
Open

Help Request - Disable NAME and SYNOPSIS Output #277

Sn3akyP3t3 opened this issue Aug 5, 2020 · 2 comments

Comments

@Sn3akyP3t3
Copy link

@Sn3akyP3t3 Sn3akyP3t3 commented Aug 5, 2020

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.

@dbieber
Copy link
Member

@dbieber dbieber commented Aug 12, 2020

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)
@Sn3akyP3t3
Copy link
Author

@Sn3akyP3t3 Sn3akyP3t3 commented Aug 12, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.