How to hide input in groovy

How can I mask input from the command line? The main use case: I want to enter a password when prompted, and I need to either see * or nothing at all.

+7
groovy
source share
1 answer

Since you can call Java libraries from Groovy, you can find your answer in the question How to hide a password in Java 5? .

In short, use Console.readPassword() (Java 6 or later).

+12
source share

All Articles