標準愚痴出力

個人的なIT作業ログです。もしかしたら一般的に参考になることが書いているかもしれません(弱気

readline ライブラリ

nyagos 以外からでも簡単に使えるよう、いろいろがんばった

package main

import (
    "context"
    "fmt"
    "github.com/zetamatta/nyagos/readline"
)

func main() {
    editor := readline.Editor{
        Default: "InitialValue",
        Cursor:  3,
    }
    text, err := editor.ReadLine(context.Background())

    if err != nil {
        fmt.Printf("ERR=%s\n", err.Error())
    } else {
        fmt.Printf("TEXT=%s\n", text)
    }
}

よかったら使ってね