Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FmtCmd ¶
type FmtCmd struct { // Name is the command name or path Name string // Args is a list of args to pass to the command. Args []string // Env is a map of additional env vars to pass to the command. Env mg.EnvMap // Langs is the list of languages in which the reducer should run Langs []mg.Lang // Actions is a list of actions on which the reducer is allowed to run. // The reducer always runs on the ViewFmt action, even if this list is empty. Actions []mg.Action }
FmtCmd is wrapper around FmtFunc for generic fmt commands.
The view src is passed to the command's stdin. It takes care of handling command failure e.g. output on stderr or no output on stdout.
type FmtFunc ¶
type FmtFunc struct { // Fmt receives a copy of the view src and returns the fmt'ed src. // // Fmt should ideally fail in the face of any uncertainty // e.g. if running a command to do the formatting and it prints anything to stderr; // it should return an error because commands do not reliably return an error status. Fmt func(mx *mg.Ctx, src []byte) ([]byte, error) // Langs is the list of languages in which the reducer should run Langs []mg.Lang // Actions is a list of actions on which the reducer is allowed to run. // The reducer always runs on the ViewFmt action, even if this list is empty. Actions []mg.Action }
FmtFunc is a reducer for generic fmt functions
it takes care of reading the view src and properly reporting any errors to the editor
Click to show internal directories.
Click to hide internal directories.