Skip to content

Commit

Permalink
(#8) Remove unnecessary CustomArgsEnabled option
Browse files Browse the repository at this point in the history
Not necessary, check if CustomArgs is not nil instead.
  • Loading branch information
jeffmccune committed Apr 16, 2024
1 parent ff23e70 commit 9ef3db9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 2 additions & 5 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 9ef3db9

Please sign in to comment.