12 ms·
Termbox-Go – A minimalistic Go curses library
- heavenlyhash 10y agoAnother alternative to consider is https://github.com/gdamore/tcell https://github.com/gdamore/tcell termbox-go has a couple of pretty wicked global variables, and they caused me a surprising amount of issues last time I used it. By contrast, tcell has good interfaces, and it shows: tcell even has a SimulationScreen you can use for testing.
- akkartik 10y agoInteresting you should mention testing, since I use termbox (not termbox-go) in a teaching/exploratory project to come up with more testable OS primitives. Among other things, I implemented a fake screen for this project. https://github.com/akkartik/mu#readme https://github.com/akkartik/mu#readme
- heavenlyhash 10y agoWow, that's... just, wow. > New, testable interfaces for the operating system. So you implemented this at the syscall level, and that just happened to include a tty? Very neat.
- akkartik 10y agoThanks! Though I don't want to overstate where we are at this point. I implemented all this at the "syscall" level for an extremely toy simulated computer. We don't really yet have the chops to implement syscalls in a real-world OS. But my collaborator and I have been slowly learning what we need. The first system we've been playing with is OpenBSD.
- cschmidt 10y agotcell is what is used by the micro editor https://github.com/zyedidia/micro https://github.com/zyedidia/micro
- chrissnell 10y agoAnother alternative that provides a higher-level interface with widgets is https://github.com/gizak/termui https://github.com/gizak/termui. I used it to build sparkyfish, my open source console-based network speed tester: https://github.com/chrissnell/sparkyfish https://github.com/chrissnell/sparkyfish
- aetherson 10y ago...curses?
- LukeShu 10y agohttps://en.wikipedia.org/wiki/Curses_(programming_library) https://en.wikipedia.org/wiki/Curses_(programming_library) The standard UNIX terminal UI library.
- lobster_johnson 10y agoSpeaking of Go and terminals, is there a library that doesn't take over the whole screen? For example, let's say I want to display a three-line progress bar. I want to update just that three-line area, and when done, remove all the lines and continue from there, and otherwise just integrate into the text flow of the terminal.
- tene 10y agoI don't know about Go, but there's quite a nice similar library for Haskell, https://hackage.haskell.org/package/concurrent-output https://hackage.haskell.org/package/concurrent-output
- lobster_johnson 10y agoRight, I'd love something like that for Go.
- dtjohnnymonkey 10y agoYou might try this from my co-worker: https://github.com/sethgrid/multibar https://github.com/sethgrid/multibar
- atombender 10y agoNice, thanks. I'd like something like that, but generalized for any output, not just progress bars.
- heavenlyhash 10y agoI started writing the dumbest-possible thing-that-can-work here: https://godoc.org/github.com/polydawn/go-slog https://godoc.org/github.com/polydawn/go-slog but don't necessarily recommend it. (There's barely enough code there to be worth linking, honestly.) It doesn't do anything fancy -- certainly not like the progress bars linked in a sibling comment -- but it also works without setting the TTY into raw mode, which means your scrollback is never disrupted.
- andrewfromx 10y agomy stackover question from August 2016 http://stackoverflow.com/questions/38728614/how-do-i-control-where-text-is-printed-to-console-via-fmt http://stackoverflow.com/questions/38728614/how-do-i-control... before i knew the term curses. Thank you photoionized, you changed my life.
- lacampbell 10y agoLast time I tried to use termbox (the C version), it required a build tool in python that I'd never heard of (waf), which then required me to do all kinds of yak-shaving to get up and running. All to compile a small C library. I'm not saying waf is bad, I've never used it (obviously, since I failed to install it). But it was an annoying hoop to jump through. I do think re-doing the old unix lib faithfuls is a Good Idea. A cleaner curses like library with a better interface would be great.
- akkartik 10y agoOnce I got it running, I figured out what commands waf was running and then ripped it out. You can see my changes inlined at https://github.com/akkartik/mu/tree/master/termbox https://github.com/akkartik/mu/tree/master/termbox Edit: ack, sorry I momentarily forgot that I also recently ripped out my project's dependence on `make`. You can see my old makefile at an earlier commit: https://github.com/akkartik/mu/blob/d9ee2076d9/termbox/makefile https://github.com/akkartik/mu/blob/d9ee2076d9/termbox/makef...
- lacampbell 10y agoWow, it was as simple as that. Legend!
- EvanMiller 10y agoI'm a fan of this library -- I used it to build Hecate (https://github.com/evanmiller/hecate https://github.com/evanmiller/hecate), a terminal hex editor. If you get creative with Unicode box and box-drawing characters, you can build some interesting interfaces (tabs, progress bars, etc).
- libeclipse 10y agoI was looking at termbox-go but then came across gocui[0], which uses termbox-go to do some really quite powerful things. [0] https://github.com/jroimartin/gocui https://github.com/jroimartin/gocui