diff --git a/cli.go b/cli.go index 9fdb498..f87e9ff 100644 --- a/cli.go +++ b/cli.go @@ -58,7 +58,7 @@ func (c *cliInstance) Run(ctx context.Context) error { c.ctx, c.cancel = context.WithCancel(ctx) args := os.Args[1:] - if c.opts.CustomArgsEnabled { + if c.opts.CustomArgs != nil { args = c.opts.CustomArgs } c.cli.MustParseWithUsage(args) diff --git a/options.go b/options.go index 0ea99b5..b8ddded 100644 --- a/options.go +++ b/options.go @@ -74,7 +74,6 @@ func (o roOptions) NatsNeySeedFile() string { return o.opts.NatsNeyS func (o roOptions) NatsCredentialsFile() string { return o.opts.NatsCredentialsFile } func (o roOptions) StartTime() time.Time { return o.opts.StartTime } func (o roOptions) ConfigBucketPrefix() string { return o.opts.ConfigBucketPrefix } -func (o roOptions) CustomArgsEnabled() bool { return o.opts.CustomArgsEnabled } func (o roOptions) CustomArgs() []string { return o.opts.CustomArgs } func (o *Options) roCopy() *roOptions { @@ -106,6 +105,8 @@ type Options struct { AdditionalFacts FactsGenerator `json:"-"` // ReadyFunc is an optional function that will be called once provisioning completes and system is fully initialized ReadyFunc ReadyFunc `json:"-"` + // CustomArgs are parsed instead of os.Args if CustomArgs is not nil + CustomArgs []string `json:"-"` // facts related opt-outs // NoStandardFacts disables gathering all standard facts @@ -123,10 +124,6 @@ type Options struct { // NoNetworkFacts disables built-in network interface facts gathering NoNetworkFacts bool `json:"no_network_facts,omitempty"` - // os.Args opt-out https://github.com/choria-io/machine-room/issues/8 - CustomArgsEnabled bool `json:"-"` - CustomArgs []string `json:"-"` - // Read only below... // ConfigurationDirectory is the directory the configuration file is stored in (RO)