Documentation
¶
Index ¶
- type ICLI
- type Option
- func WithCompFindOptions(opts ...query.Option) Option
- func WithConfigFilename(filename string) Option
- func WithDescription(desc string) Option
- func WithName(name string) Option
- func WithStages(ss ...stage.Stage) Option
- func WithTargetToStageMapper(mapper stage.TargetNameToStageMapper) Option
- func WithTargetToStageMapperDefault() Option
- func WithToolchainDispatcher(dispatcher toolchain.IDispatcher) Option
- func WithToolchainDispatcherNix(flakeDir string, argsSelector nixtoolchain.ArgsSelector) Option
- func WithVersion(version *version.Version) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ICLI ¶
type ICLI interface {
// The root directory from where certain operations are done,
// i.e finding components etc.
RootDir() string
// RootCmd returns the root command on the CLI.
RootCmd() *cobra.Command
// RootArgs returns the root arguments for the CLI.
RootArgs() *rootcmd.Args
// Stages returns the set stage.
Stages() stage.Stages
// Config returns the overall customized config for the CLI.
Config() config.IConfig
// RunnerFactory gets the runner factory.
RunnerFactory() factory.IFactory
// toolchainDispatcher gets the toolchain dispatch function.
ToolchainDispatcher() toolchain.IDispatcher
// FindComponents returns components `comps` found by arguments `args` and
// and all searched components `all` (needed to construct the DAG).
FindComponents(args *general.ComponentArgs) (
comps []*component.Component,
all []*component.Component,
rootDir string,
err error,
)
// Run will run the CLI.
Run() error
}
type Option ¶
type Option func(c *cliApp) error
func WithCompFindOptions ¶ added in v0.24.0
WithCompFindOptions adds component find options which will be added by default to the `FindComponents` command.
func WithConfigFilename ¶
WithConfigFilename sets the components config filename which is used to find components, default is `comp.ConfigFileName`.
func WithDescription ¶
WithDescription setts the description on the CLI application.
func WithStages ¶
WithStageTypes sets the stage types you want to use over all the project. Each stage also comes with a priority, so you have to order them here accordingly how they would appear in execution order. This is used internally to guard wrong configuration and may be used for sorting targets into stage.
func WithTargetToStageMapper ¶
func WithTargetToStageMapper(mapper stage.TargetNameToStageMapper) Option
WithTargetToStageMapper installs a custom target name to stage mapper. This is useful to not name the `stage` keyword in every target config.
func WithTargetToStageMapperDefault ¶
func WithTargetToStageMapperDefault() Option
WithTargetToStageMapperDefault installs a default target name to stage mapper. This is useful to not name the `stage` keyword in every target config.
- If the target name contains a suffix equal to a stage name, this stage name will be default assigned (if not set).
func WithToolchainDispatcher ¶
func WithToolchainDispatcher(dispatcher toolchain.IDispatcher) Option
WithToolchainDispatcher sets a toolchain dispatcher which is used to dispatches to the toolchain a runner specifies.
func WithToolchainDispatcherNix ¶
func WithToolchainDispatcherNix( flakeDir string, argsSelector nixtoolchain.ArgsSelector, ) Option
WithToolchainDispatcherNix sets a toolchain dispatcher which will execute a runner by launching the following command inside a Nix development shell with name `toolchain`: ```shell
argsv[0] execute --running-in-toolchain --config temp.yaml
``` Where the parameters for `exec` are marshaled to `temp.yaml`. NOTE: When you use this option, you need to add the `execute` command with `exec.AddCmd` to the root command.
func WithVersion ¶
WithVersion setts the version on the CLI application.