mini2Dx / parcl

Gradle plugin for bundling your Java application for distribution on Windows, Mac and Linux
MIT License
60 stars 15 forks source link

Pass command line arguments to packaged program on Windows #13

Closed TheGreatCabbage closed 5 years ago

TheGreatCabbage commented 5 years ago

Thanks for this excellent plugin. The only problem for me is that command line arguments are necessary to my program, and I need to be able to supply them at runtime. My pull request makes command line arguments usable on Windows only.

I noticed that any arguments passed to the .exe cause it to create an example config instead of running the packaged program. To allow arguments to be passed to the program, I modified Program.cs so that only a single argument, --example will trigger this behaviour.

To clarify the new behaviour, here are examples for a program packaged as TestProgram.exe:

.\TestProgram.exe runs packaged program with no args

.\TestProgram.exe --example creates example config

.\TestProgram.exe --example testarg1 runs packaged program with args --example and testarg1

.\TestProgram.exe testarg1 --example runs packaged program with args testarg1 and --example

.\TestProgram.exe testarg1 runs packaged program with args testarg1

.\TestProgram.exe testarg1 testarg2 runs packaged program with args testarg1 and testarg2

tomcashman commented 5 years ago

Thank you so much for contributing. I've push 1.6.0 to Maven Central now :)