1

I am trying to make a small command line tool using python-fire module by google. My filename is my_tools.py. Inside my_tools.py I have code

class MainFunction():
   def __init__(self):
      self.config = WrapperConfig()
   def hey_world(self):
      print("hey world")

if __name__ == '__main__':
   fire.Fire(MainFunction)

When I run the command python my_tools.py in the terminal I get the Output as:

NAME                                                                                                                        
  my_tools.py                                                                                                                                                                                                                                 
SYNOPSIS                                                                                                                    
  my_tools.py GROUP | COMMAND                                                                                                                                                                                                                 
GROUPS                                                                                                                      
  GROUP is one of the following:                                                                                                                                                                                                                   
  config                                                                                                                                                                                                                                     
COMMANDS                                                                                                                    
  COMMAND is one of the following:                                                                                                                                                                                                                 
  hey_world

View Output Here

Is there any way where I can customize this default help text?

1 Answers1

0

You can add docstring to the class and function.

class MainFunction():
   """description of MainFunction"""
   def __init__(self):
      self.config = WrapperConfig()
   def hey_world(self):
   """description of hey_world"""
      print("hey world")

if __name__ == '__main__':
   fire.Fire(MainFunction)
heyu91
  • 1,174
  • 11
  • 18