cbeust / jcommander

Command line parsing framework for Java
Apache License 2.0
1.96k stars 334 forks source link

Add option for not allowing password to be entered on command line #452

Open ShiyunHUANG opened 6 years ago

ShiyunHUANG commented 6 years ago

For applications with high security requirement, passwords should not be exposed on the command line because they will be logged in command history. So we would want an option that always prompt the password even if it is provided in the argument. But after this fix https://github.com/cbeust/jcommander/issues/195 there is no way to prevent the user from entering the password on command line with password option. So I suggest to provide a flag or parameter for securing password which will not take additional arguments entered on the command line and always prompt the user to enter password when used. The followings are examples of the desired behaviors: (1) positive case: somecli -password Enter password: (2) negative case: somecli -password Error: invalid argument. Refer to usage . Thanks.