I just finished writing a code in Python and converted it into a .exe file, and as a add-on I want to add a help
command to show on a command prompt a quick explanation of what my program does. Do I have to add the parameter in my .py file or do I need to create a .ini/.bat file for this parameter?
What I want to happen: In the path of my .exe directory on CMD, type a help
command to show a text of what my program does.
Raya's answer is good, but the code can be even shorter. You don't need to add a specific help option to the parser. This will be added by default if you initialise the parser with a description argument, e.g.,
import argparse
parser = argparse.ArgumentParser(description="My code does great stuff")
args = parser.parse_args()
Then running
myprogram.exe --help
will give:
My code does great stuff
optional arguments:
-h, --help show this help message and exit