sh icon indicating copy to clipboard operation
sh copied to clipboard

cmd/gosh: add basic readline functionality

Open mvdan opened this issue 4 years ago • 4 comments

gosh is not meant to replace a full interactive shell, but it would still be nice to have the basics like being able to use the arrow keys to run previous commands.

This should be pure Go, so perhaps https://github.com/peterh/liner would do.

mvdan avatar Feb 17 '21 10:02 mvdan

@mvdan I'm using your library as a shell in an experimental Linux(ish) OS I'm building where the Init, and all Userland are written in Go. As such, would it be possible to handle some typical key-bindings like ^L for clearing the screen?

prologic avatar Jul 02 '22 18:07 prologic

Looks like the liner package would do the trick nicely 👌

prologic avatar Jul 02 '22 18:07 prologic

Happy to accept PRs for this :)

mvdan avatar Jul 03 '22 15:07 mvdan

Worth noting that u-root have a modified version of gosh now as well, and they seem to use their own interactive prompt package: https://github.com/u-root/u-root/blob/HEAD/cmds/core/gosh/gosh.go

mvdan avatar Mar 18 '23 10:03 mvdan