takluyver / pynsist

Build Windows installers for Python applications
https://pynsist.readthedocs.io/
Other
882 stars 119 forks source link

How to ship CLI and GUI of same application together? #232

Closed wxguy closed 1 year ago

wxguy commented 3 years ago

My application has a support for both Command Line and Graphical User Interface. When the user enter application name without argument, then the GUI is launched and if arguments are provided, then it works as CLI. Is there a way to include these two features together with Pynsist?

takluyver commented 3 years ago

You can include a command by adding a command section to the installer.cfg file. The command calls a Python function (usually something like main()), which can do whatever you want.

You'll also get at least one start menu shortcut. The preferred way to define this is also pointing to a Python function. It sounds like in your case the shortcut can point to the same function as the command, so it's equivalent to running the command with no arguments.