@@ -0,0 +1,1696 @@
+package picocli.examples.interactive;%0A%0Aimport picocli.CommandLine.Command;%0A%0Aimport java.security.MessageDigest;%0Aimport java.util.Arrays;%0Aimport java.util.Base64;%0Aimport java.util.concurrent.Callable;%0A%0A@Command(name = %22interactive%22, subcommands = EnterPasswordCommand.class)%0Apublic class InteractivePositionalParam implements Callable%3CInteger%3E %7B%0A    @Override%0A    public Integer call() throws Exception %7B%0A        System.out.println(%22This command needs a subcommand%22);%0A        return null;%0A    %7D%0A%7D%0A%0A@Command(name = %22password%22,%0A        description = %22Prompts for a password and prints its MD5 hash%22)%0Aclass EnterPasswordCommand implements Callable%3CVoid%3E %7B%0A%0A    // https://github.com/remkop/picocli/issues/840%0A    // Picocli cannot handle _single_ interactive positional parameters:%0A    // an interactive positional parameter must be followed by another positional parameter.%0A    //%0A    // Alternatively: use the System.console().readPassword() API directly:%0A%0A    @Override%0A    public Void call() throws Exception %7B%0A        char%5B%5D password = System.console().readPassword(%22Password to encrypt%22);%0A%0A        byte%5B%5D raw = char2bytes(password);%0A        MessageDigest md5 = MessageDigest.getInstance(%22MD5%22);%0A        System.out.printf(%22Your password is hashed to %25s.%25n%22, base64(md5.digest(raw)));%0A%0A        Arrays.fill(password, '*');%0A        Arrays.fill(raw, (byte) 0);%0A        return null;%0A    %7D%0A%0A    private byte%5B%5D char2bytes(char%5B%5D password) %7B%0A        byte%5B%5D raw = new byte%5Bpassword.length%5D;%0A        for (int i = 0; i %3C raw.length; i++) %7B raw%5Bi%5D = (byte) password%5Bi%5D; %7D%0A        return raw;%0A    %7D%0A%0A    private String base64(byte%5B%5D bytes) %7B%0A        return Base64.getEncoder().encodeToString(bytes);%0A    %7D%0A%7D%0A

Add example showing alternative to single interactive positional parameter