Is there any library for building a CLI app with rich menus?

polaris · 2017-09-17 01:00:06 · 584 次点击    
这是一个分享于 2017-09-17 01:00:06 的资源,其中的信息可能已经有所发展或是发生改变。

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:

I'm not entirely sure what you are looking for, but have you had a look at go-prompt? It is serously cool!

Kraigius:

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.

c-bata:

Hi! I'm an author of go-prompt. Thank you for your consideration.

How about survey? I've never used this, but looks interesting.

Killing_Spark:

Ncurses maybe?

natefinch:

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).

Kraigius:

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.

natefinch:

Ah yes, sorry I forgot it's AGPLv3. That's unfortunate.

Rhelza:

Like this one (urfave/cli)?


入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

584 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传