Categorygithub.com/sawadashota/prompt-editor
modulepackage
0.1.0
Repository: https://github.com/sawadashota/prompt-editor.git
Documentation: pkg.go.dev

# README

Prompt Editor

CircleCI GoDoc codecov Go Report Card GolangCI

Open editor in console app.

Installation

$ go get -u github.com/sawadashota/prompt-editor

Usage

type User struct { 
	Name string `json:"name"`
}

func main() {
	user := &User{"Alice"}

	// second argument is default value option
	editor, err := prompteditor.New("vi", prompteditor.MarshalJSON(user))
	if err != nil { 
		// error handling
	}

	if err := editor.Open(); err != nil {
		// error handling
	}

	var edited User
	if err := editor.UnmarshalEdited(&edited); err != nil {
		// error handling
	}

	fmt.Println(user.Name)
	// print edited user name
}

# Functions

MarshalJSON form struct.
New Editor.

# Variables

TempFileName .

# Structs

Editor .

# Type aliases

OriginalData .