remkop / picocli

Picocli is a modern framework for building powerful, user-friendly, GraalVM-enabled command line apps with ease. It supports colors, autocompletion, subcommands, and more. In 1 source file so apps can include as source & avoid adding a dependency. Written in Java, usable from Groovy, Kotlin, Scala, etc.
https://picocli.info
Apache License 2.0
4.94k stars 424 forks source link

New feature suggestion: choicelist and checkboxes #519

Open cyChop opened 6 years ago

cyChop commented 6 years ago

Inspired from Yeoman and https://medium.com/@jdxcode/12-factor-cli-apps-dd3c227a0e46 (point 7)

Modern CLIs often propose a dynamic choicelist when they can rather than a traditional prompt. Could we imagine integrating such a feature in picocli?

(Off-topic: picocli is great, thanks for having made it!)

remkop commented 6 years ago

Interesting! I wonder if this functionality should live in picocli-shell-jline2: jline combined with picocli gives a good base for interactive CLI features.

cyChop commented 6 years ago

I didn't know JLine but it indeed seems to work well as this will require to monitor the arrow keys.

remkop commented 6 years ago

Nice! oclif seems to have tons of interesting features. Very inspiring!

Do you think you'll be able to provide a pull request for any of these?

cyChop commented 6 years ago

I think it unlikely, alas, as I probably won't have the time I'd like to look into these. If I succeed however, I'll be sure to fork and share!

xvik commented 6 years ago

There was a nice attempt to build inquirer.js like prompting based on jline: https://github.com/awegmann/consoleui (video)

It seems to be abandoned now, but still could be a good starting point for a new implementation.

remkop commented 6 years ago

Nice find, @xvik!

bobtiernay-okta commented 6 years ago

This very cool! I plan to try this.

Perhaps just a link and some example of how to integrate console ui in the readme is all that is needed?

remkop commented 6 years ago

That sounds like it would give a lot of bang for its buck! Please let me know when you have some good examples.

bobtiernay-okta commented 6 years ago

The one thing I'm noticing about this library is that its not very customizable in terms of the ansi styling. I think it might be fairly straight forward to port, but I just don't have the time at the moment.

All said, I would be willing to add some links and examples to the README.md if that makes sense. Let me know.

remkop commented 6 years ago

I agree: I also am not currently planning to port this project. Perhaps some kind of project cooperation (if the maintainers are interested) would be an idea.

Regardless of how that works out though, adding some links and examples to the picocli-shell-jline2 readme makes a lot of sense to me.