Yesterday I moved one of my software to spf13/cobra and apart from a few things I'm satisfied with the result and the cobra library.
However, for a different software I want to build rich menus where after a user inputted a command + flag, a menu with different options will appear. Is there any library that can help me do that?
评论:
gargamelus:
Kraigius:I'm not entirely sure what you are looking for, but have you had a look at go-prompt? It is serously cool!
c-bata:I take it back. Maybe I don't want a rich interface after all. I'd be happy with just menus with number/letter selections.
go-prompt looks great but overkill for my case.
Killing_Spark:Hi! I'm an author of go-prompt. Thank you for your consideration.
How about survey? I've never used this, but looks interesting.
natefinch:Ncurses maybe?
Kraigius:This is a library I wrote for my last job. It does exactly what you're asking for below: https://godoc.org/github.com/juju/juju/cmd/juju/interact
Especially check out the Pollster type. It's for asking a user for information, you can give it a list of options to choose from, etc
I don't recommend importing that library directly, instead fork it into your own repo, since I wouldn't trust it to stay stable (you may also want to remove the jsonschema query... it brings in a ton of code that you likely don't need).
natefinch:Thank you very much. I'll have to evaluate the license as I think it's a viral one and I might not be able to bring the code under my project but in either case I want to thank you.
Rhelza:Ah yes, sorry I forgot it's AGPLv3. That's unfortunate.
Like this one (urfave/cli)?
