Editing a string with prompt in terminal?

polaris · · 458 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hi fellow gophers!</p> <p>I am working on a simple terminal-based todolist app, and I&#39;m currently focusing on editing a todo. Ideally for editing I would allow the user to edit the existing todo description by showing it on the screen.</p> <p>For instance, if the user requests to edit a todo with id 23:</p> <pre><code>~ todo edit 23 &gt; Chat with @frank due tomorrow &lt;cursor here&gt; </code></pre> <p>The user could backspace, etc or edit text on the screen, and the todo would be saved when the user hits the enter key. </p> <p>I&#39;m wondering if there&#39;s a library to handle this, or if not what I should be Googling for if I want to make my own library to do this.</p> <p>Any help would be greatly appreciated! Thanks in advance!</p> <hr/>**评论:**<br/><br/>still_unregistered: <pre><p>I used gocui <a href="https://github.com/jroimartin/gocui/" rel="nofollow">https://github.com/jroimartin/gocui/</a> for a little porject : <a href="https://github.com/gophersiesta/gophersiesta/blob/master/gui/root.go" rel="nofollow">https://github.com/gophersiesta/gophersiesta/blob/master/gui/root.go</a></p> <p>Very easy to work with</p></pre>earthboundkid: <pre><p>Go CUI is a wrapper around <a href="https://godoc.org/github.com/nsf/termbox-go" rel="nofollow">https://godoc.org/github.com/nsf/termbox-go</a>. Depending on the project it may also be suitable for this todo app by itself.</p></pre>natalchile: <pre><p><a href="https://github.com/chzyer/readline" rel="nofollow">https://github.com/chzyer/readline</a></p></pre>raff99: <pre><p>This works on multiple platforms (Linux, Windows, OSX): <a href="https://github.com/peterh/liner" rel="nofollow">https://github.com/peterh/liner</a></p></pre>

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

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