Search code examples
spring-shell

Spring shell 2.0 how to read inputs with mask


Is there any way to mask user inputs in Spring Shell 2.0.x ?

I need to collect password from user.. did not find any shell api to do that.

Thanks!!


Solution

  • Found that LineReader#readLine(msg,mask) provides that option.

    All you have to do is inject the LineReader bean.