Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/knz/go-libedit
Go wrapper around the BSD libedit replacement to GNU readline
https://github.com/knz/go-libedit
Last synced: 10 days ago
JSON representation
Go wrapper around the BSD libedit replacement to GNU readline
- Host: GitHub
- URL: https://github.com/knz/go-libedit
- Owner: knz
- License: apache-2.0
- Created: 2017-09-03T13:56:20.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-06-21T13:34:39.000Z (over 1 year ago)
- Last Synced: 2024-10-14T10:54:34.278Z (25 days ago)
- Language: C
- Size: 303 KB
- Stars: 6
- Watchers: 4
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-libedit
Go wrapper around `libedit`, a replacement to GNU readline using the BSD license.
[![travis](https://travis-ci.org/knz/go-libedit.svg?branch=master)](https://travis-ci.org/knz/go-libedit)
How to use:
- `go build` / `go install`
- see `test/example.go` for a demo.
- basic idea: call `Init()` once. Then call `SetLeftPrompt()` and
`GetLine()` as needed. Finally call `Close()`.## How to force using the system-wide libedit on GNU/Linux
By default, the **go-libedit** package uses the bundled `libedit`
sources on GNU/Linux, so that `go get` works out of the box.To force the package to use a system-wide libedit instead, edit `unix/editline_unix.go` as follows:
- remove the line containing `#cgo linux CFLAGS`
- change the line containing `#cgo linux CPPFLAGS` to read: `#cgo linux CPPFLAGS: -I/usr/include/editline -Ishim`
- change the line containing `#cgo linux LDFLAGS` to read: `#cgo linux LDFLAGS: -ledit`## macOS/OSX due to restrictions due to changes macOS Mojave
macOS Mojave is shipped with a broken/restricted libedit where the
completion API is not published. Because it is not possible to
automatically detect macOS versions, **go-libedit** will use a reduced
autocompletion facility on all versions of macOS instead.This autocompletion facility lacks the following features from libedit:
- it cannot autocomplete file and directory names.
- it does not display a list of possible completions. Only the fact
that more than 1 completion is available is signalled using
a terminal beep.## How to refresh the bundled libedit sources
(Only needed when upgrading the bundled `libedit` to a newer version.)
This procedure should be ran on a Debian/Ubuntu system.
1. ensure that `/etc/apt/sources.list` contains source repositories, i.e. the `deb-src` lines are uncommented. Run `apt-get update` as necessary.
2. run:```
$ sudo apt-get install libbsd libbsd-dev libncurses-dev`
$ cd src
$ bash refresh.sh
```