Documentation
¶
Index ¶
- Constants
- func CopyCommandChain(cmd *cobra.Command, args ...string) (cmdCpy, rootCpy *cobra.Command)
- func DryRunCobraCommand(ctx context.Context, wd string, cmd *cobra.Command, handler TestDryRunHandler, ...) error
- func DryRunShellWithFilter(ignoreMatched bool, matchers ...matcher.StringMatcher) cmdutils.DryRunFunc
- func PathRelativeToTestdata(pathComponents ...string) string
- func SetupDryRun(handler TestDryRunHandler) test.SetupFunc
- func SetupResetPackageVars() test.SetupFunc
- func WithDryRun(handler TestDryRunHandler) test.Options
- type TestDryRunHandler
Constants ¶
View Source
const ( TestTmpDir = ".tmp" TestOutputDir = "output" )
Variables ¶
This section is empty.
Functions ¶
func CopyCommandChain ¶
CopyCommandChain do following things: - Make copy of given command and its parents/ancestors. - Fix arguments of its ancestors. - Attach the given command chain to a copy of predefined test root command (to mimic how main() function works) This function returns copied command and a copy of its root command. Two values may be same if they are the root
func DryRunCobraCommand ¶
func DryRunCobraCommand(ctx context.Context, wd string, cmd *cobra.Command, handler TestDryRunHandler, args ...string) error
DryRunCobraCommand Run given cobra.Command in given work dir relative to "testdata"
func DryRunShellWithFilter ¶
func DryRunShellWithFilter(ignoreMatched bool, matchers ...matcher.StringMatcher) cmdutils.DryRunFunc
func PathRelativeToTestdata ¶
func SetupDryRun ¶
func SetupDryRun(handler TestDryRunHandler) test.SetupFunc
func SetupResetPackageVars ¶
func WithDryRun ¶
func WithDryRun(handler TestDryRunHandler) test.Options
Types ¶
type TestDryRunHandler ¶
type TestDryRunHandler map[cmdutils.DryRunCmdType]cmdutils.DryRunFunc
func (TestDryRunHandler) Handle ¶
func (h TestDryRunHandler) Handle(ctx context.Context, cmdType cmdutils.DryRunCmdType, args ...interface{}) (interface{}, error)
Click to show internal directories.
Click to hide internal directories.