python-fire icon indicating copy to clipboard operation
python-fire copied to clipboard

Verbose help message on objects when possible: No flags and --help flag consistent behavior

Open ESPR3SS0 opened this issue 1 year ago • 0 comments

Issue: Fixes https://github.com/google/python-fire/issues/438

Given an object that has no init method, or the init method takes no arguments besides self passing a '--help' flag results in a less verbose help message than if no flag was passed at all.

Cause:

  • When --help flag is provided, an object is not instantiated so the help message is less verbose
  • When no flag is provided, and the class requires no arguments, an object is instantiated so the help message is more verbose

Fix: A check to see if the object contains an init method, and whether or not the init method requires arguments fixes this. If no arguments are required, instantiate an object then show the help message.

ESPR3SS0 avatar Mar 23 '24 14:03 ESPR3SS0