Documentation
¶
Overview ¶
Package summon does the heavy lifting of instanciating files or executing configured scripts on the user's machine.
You can control instantiation by using Options described below.
Index ¶
- Variables
- func FlattenStrings(args ...interface{}) []string
- func GetFs() afero.Fs
- type ConfigurableLister
- type ConfigurableRunner
- type Configurer
- type Driver
- func (d *Driver) AddFlag(cmd *cobra.Command, name string, flagSpec *config.FlagSpec, global bool, ...) *flagValue
- func (d *Driver) AddFlags(cmd *cobra.Command, flags config.Flags, global bool)
- func (d *Driver) Configure(opts ...Option) error
- func (d *Driver) ConstructCommandTree(root *cobra.Command, runCmdEnabled bool) (*cobra.Command, error)
- func (d Driver) HideAssetsInHelp() bool
- func (d *Driver) List(opts ...Option) ([]string, error)
- func (d Driver) OutputDir() string
- func (d *Driver) RegisterFlags(runRoot *cobra.Command)
- func (d *Driver) RenderArgs(args ...string) ([]string, error)
- func (d *Driver) Run(opts ...Option) error
- func (d *Driver) SetupRunArgs(root *cobra.Command)
- func (d *Driver) Summon(opts ...Option) (string, error)
- type Lister
- type MainOptions
- type Option
- func All(all bool) Option
- func Args(args ...string) Option
- func CobraCmd(cmd *cobra.Command) Option
- func Debug(enable bool) Option
- func Dest(dest string) Option
- func DryRun(enable bool) Option
- func ExecCmd(e command.ExecCommandFn) Option
- func Filename(filename string) Option
- func JSON(j *string) Option
- func Out(w io.Writer) Option
- func Raw(raw bool) Option
- func Ref(ref string) Option
- func ShowTree(tree bool) Option
- func WithPrompter(p Prompter) Option
- type Prompt
- type Prompter
- type Runner
- type Summon
- type Summoner
Constants ¶
This section is empty.
Variables ¶
var Name = "summon"
Name holds the name of the driver executable. By default it is "summon"
Functions ¶
func FlattenStrings ¶ added in v0.12.0
func FlattenStrings(args ...interface{}) []string
FlattenStrings takes an array of string values or string slices and returns an flattened slice of strings.
Types ¶
type ConfigurableLister ¶ added in v0.8.0
type ConfigurableLister interface { Configurer Lister }
ConfigurableLister allows configuration and listing.
type ConfigurableRunner ¶ added in v0.8.0
type ConfigurableRunner interface { Configurer Runner }
ConfigurableRunner is a runner that can be configured.
type Configurer ¶ added in v0.8.0
Configurer allows configuring a driver from variadic options.
type Driver ¶ added in v0.8.0
type Driver struct {
// contains filtered or unexported fields
}
Driver manages functionality of summon.
func (*Driver) Configure ¶ added in v0.8.0
Configure is used to extract options and customize the summon.Driver.
func (*Driver) ConstructCommandTree ¶ added in v0.14.0
func (Driver) HideAssetsInHelp ¶ added in v0.14.0
func (*Driver) RegisterFlags ¶ added in v0.15.0
func (*Driver) RenderArgs ¶ added in v0.14.0
func (*Driver) Run ¶ added in v0.8.0
Run will run executable scripts described in the summon.config.yaml file of the data repository module.
func (*Driver) SetupRunArgs ¶ added in v0.15.0
SetupRunArgs ensures that the cobra command receives correct arguments when help is requested.
type MainOptions ¶ added in v0.12.0
type MainOptions struct {
WithoutRunSubcmd bool
}
MainOptions are used to configure summon at build time
type Option ¶
type Option func(*options) error
Option allows specifying configuration settings from the user.
func Dest ¶
Dest specifies where the file(s) will be rooted. '-' is a special value representing stdout.
func ExecCmd ¶ added in v0.8.0
func ExecCmd(e command.ExecCommandFn) Option
ExecCmd allows changing the execution function for external processes.
func WithPrompter ¶ added in v0.17.0
WithPrompter configures the prompter. This is mostly used in testing.
type Prompter ¶ added in v0.17.0
type Prompter interface { NewPrompt(userPrompt string) Choose(choices []string) (string, error) Input(defaultVal string) (string, error) }
Prompter allows prompting the user.
type Runner ¶ added in v0.8.0
type Runner interface { Run(opts ...Option) error ConstructCommandTree(*cobra.Command, bool) (*cobra.Command, error) }
Runner allows executing configured aliases from summon.config.yaml.