Exemple #1
0
func addHistory(line string) error {
	lineCString := C.CString(line)
	res := C.linenoiseHistoryAdd(lineCString)
	C.free(unsafe.Pointer(lineCString))
	if res != 1 {
		return errors.New("Could not add line to history.")
	}
	return nil
}
Exemple #2
0
func HistoryAdd(line string) (done bool) {
	l := C.CString(line)
	defer C.free(unsafe.Pointer(l))
	i := C.linenoiseHistoryAdd(l)
	if i == 1 {
		done = true
	} else {
		done = false
	}
	return done
}