Documentation
¶
Index ¶
- Constants
- func CaptureInputFromEditor(content string, resolveEditor PreferredEditorResolver) ([]byte, error)
- func GetOptionValue(args []string, emsg string, ss string, sl string) (string, error)
- func GetPreferredEditorFromEnvironment() string
- func OpenFileInEditor(filename string, resolveEditor PreferredEditorResolver) error
- func SliceIndex(limit int, predicate func(i int) bool) int
- type PreferredEditorResolver
Constants ¶
View Source
const DefaultEditor = "vim"
DefaultEditor is vim
Variables ¶
This section is empty.
Functions ¶
func CaptureInputFromEditor ¶
func CaptureInputFromEditor(content string, resolveEditor PreferredEditorResolver) ([]byte, error)
CaptureInputFromEditor opens a temporary file in a text editor and returns the written bytes on success or an error on failure. It handles deletion of the temporary file behind the scenes.
func GetOptionValue ¶
GetOptionValue fetches value for a given option in command line arguments
func GetPreferredEditorFromEnvironment ¶
func GetPreferredEditorFromEnvironment() string
GetPreferredEditorFromEnvironment returns the user's editor as defined by the `$EDITOR` environment variable, or the `DefaultEditor` if it is not set.
func OpenFileInEditor ¶
func OpenFileInEditor(filename string, resolveEditor PreferredEditorResolver) error
OpenFileInEditor opens filename in a text editor.
Types ¶
type PreferredEditorResolver ¶
type PreferredEditorResolver func() string
PreferredEditorResolver is a function that returns an editor that the user prefers to use, such as the configured `$EDITOR` environment variable.
Click to show internal directories.
Click to hide internal directories.