Documentation ¶
Overview ¶
Package mockedit provides a mock implementation of an editor. It's a a simple process controlled with environment variables:
- MOCKEDIT_GIVE: Specifies the path to a file that contains the contents to write for an edit operation. This is required.
- MOCKEDIT_RECORD: Specifies the path to a file where contents of an edited file should be written. This is optional.
The process expects the path to a file to edit as its only argument.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Main ¶
func Main() (exitCode int)
Main runs the mock editor and exits the process. Usage:
mockedit <file>
mockedit writes the contents of MOCKEDIT_GIVE into the given file. If MOCKEDIT_GIVE is not set, the file is returned unchanged. If MOCKEDIT_RECORD is set, it will also copy the contents of <file> into it.
If both MOCKEDIT_GIVE and MOCKEDIT_RECORD are unset, mockedit will fail.
Types ¶
type Handle ¶
type Handle struct {
// contains filtered or unexported fields
}
Handle controls the behavior of the mock editor.
func Expect ¶
Expect tells mockedit to expect a new edit operation.
By default, following an Expect call, mockedit will write back the file unchanged.
Use Give to specify the contents to write back.
func (*Handle) Give ¶
Give tells mockedit to write the given contents back for the next edit operation.