history

package
v0.0.0-...-486954f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Example (History)
_, err := LoadHistory("notexist")
fmt.Println(err)
_, err = LoadHistory("/dev/null/notvalid")
fmt.Println(err)
err = SaveHistory(nil, "/dev/null/notvalid")
fmt.Println(err)

f, err := ioutil.TempFile("", "test")
if err != nil {
	fmt.Println(err)
	return
}
fname := f.Name()
f.Close()
defer os.Remove(fname)
err = SaveHistory(nil, fname)
fmt.Println(err)
_, err = LoadHistory(fname)
fmt.Println(err)
Output:

<nil>
open /dev/null/notvalid: not a directory
open /dev/null/notvalid: not a directory
<nil>
<nil>

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadHistory

func LoadHistory(fileName string) ([]string, error)

LoadHistory loadsa a history from a file loaded from the specified path. The file must be in the same format as used by libedit.

func SaveHistory

func SaveHistory(h []string, fileName string) (retErr error)

SaveHistory saves a history to the specified file. The file will be written in the same format as used by libedit.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL