Skip to content

Commit

Permalink
Merge pull request #12 from jeffmccune/jeff/8-support-cobra
Browse files Browse the repository at this point in the history
(#8) Remove unnecessary CustomArgsEnabled option
  • Loading branch information
ripienaar authored Apr 17, 2024
2 parents c781d02 + a645a79 commit c604da2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ func (c *cliInstance) Run(ctx context.Context) error {
c.ctx, c.cancel = context.WithCancel(ctx)

args := os.Args[1:]
if c.opts.CustomArgsEnabled {
args = c.opts.CustomArgs
if c.opts.Args != nil {
args = c.opts.Args
}
c.cli.MustParseWithUsage(args)

Expand Down
9 changes: 3 additions & 6 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ 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 roOptions) Args() []string { return o.opts.Args }

func (o *Options) roCopy() *roOptions {
return &roOptions{*o}
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:"-"`
// Args are parsed instead of os.Args if Args is not nil
Args []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 c604da2

Please sign in to comment.