Are you looking for powerful tools to automatically generate command-line interfaces to make your life easier, and build a nice GUI for them? You can build it easily by combining Fire and Python4Delphi library, inside Delphi and C++Builder.
Python Fire is a library for automatically generating command-line interfaces (CLIs) with a single line of code.
It will turn any Python module, class, object, function, etc. (any Python component will work!) into a CLI. It’s called Fire because when you call Fire(), it fires off your command.
Python’s Fire library will enable us to:
- Python Fire is a simple way to create a CLI in Python. 
- Python Fire is a helpful tool for developing and debugging Python code. 
- Python Fire helps with exploring existing code or turning other people’s code into a CLI. 
- Python Fire makes transitioning between Bash and Python easier. 
- Python Fire makes using a Python REPL easier by setting up the REPL with the modules and variables you’ll need already imported and created. 
This post will guide you on how to automatically generate your own CLI using the Fire library and create it using Python for Delphi in the Delphi Windows GUI app.First, open and run our Python GUI using project Demo1 from Python4Delphi with RAD Studio. Then insert the script into the lower Memo, click the Execute button, and get the result in the upper Memo. You can find the Demo1 source on GitHub. The behind the scene details of how Delphi manages to run your Python code in this amazing Python GUI can be found at this link.
Let’s create a CLI for a simple “Hello World!”:
return "Hello %s!" % name
if __name__ == '__main__':
And run it in our Python GUI:
Save the script above as helloFire1.py, and then let’s test our CLI for printing “Hello World!” using these commands:
python helloFire1.py --name=Dexter
python helloFire1.py --help
Congratulations, now you have learned how to automatically generate your own CLI using the Fire library and create it using Python for Delphi in the Delphi Windows GUI app!
Check out the Fire library for Python and use it in your projects: https://pypi.org/project/fire/ and
Check out Python4Delphi which easily allows you to build Python GUIs for Windows using Delphi: https://github.com/pyscripter/python4delphi