diff --git a/pkg/commands/acl/create.go b/pkg/commands/acl/create.go index 30e529817..786674849 100644 --- a/pkg/commands/acl/create.go +++ b/pkg/commands/acl/create.go @@ -13,13 +13,16 @@ import ( // NewCreateCommand returns a usable command registered under the parent. func NewCreateCommand(parent cmd.Registerer, globals *config.Data, data manifest.Data) *CreateCommand { - var c CreateCommand + c := CreateCommand{ + Base: cmd.Base{ + Globals: globals, + }, + manifest: data, + } + c.CmdClause = parent.Command("create", "Create a new ACL attached to the specified service version").Alias("add") - c.Globals = globals - c.manifest = data - // Required flags - c.CmdClause.Flag("name", "Name for the ACL. Must start with an alphanumeric character and contain only alphanumeric characters, underscores, and whitespace").Action(c.name.Set).StringVar(&c.name.Value) + // required c.RegisterFlag(cmd.StringFlagOpts{ Name: cmd.FlagVersionName, Description: cmd.FlagVersionDesc, @@ -27,7 +30,7 @@ func NewCreateCommand(parent cmd.Registerer, globals *config.Data, data manifest Required: true, }) - // Optional flags + // optional c.RegisterAutoCloneFlag(cmd.AutoCloneFlagOpts{ Action: c.autoClone.Set, Dst: &c.autoClone.Value, @@ -45,6 +48,8 @@ func NewCreateCommand(parent cmd.Registerer, globals *config.Data, data manifest Dst: &c.serviceName.Value, }) + c.CmdClause.Flag("name", "Name for the ACL. Must start with an alphanumeric character and contain only alphanumeric characters, underscores, and whitespace").Action(c.name.Set).StringVar(&c.name.Value) + return &c } diff --git a/pkg/commands/acl/delete.go b/pkg/commands/acl/delete.go index dcb629581..abdf411f6 100644 --- a/pkg/commands/acl/delete.go +++ b/pkg/commands/acl/delete.go @@ -14,12 +14,11 @@ import ( // NewDeleteCommand returns a usable command registered under the parent. func NewDeleteCommand(parent cmd.Registerer, globals *config.Data, data manifest.Data) *DeleteCommand { var c DeleteCommand - c.CmdClause = parent.Command("delete", "Delete an ACL from the specified service version").Alias("remove") c.Globals = globals c.manifest = data + c.CmdClause = parent.Command("delete", "Delete an ACL from the specified service version").Alias("remove") // Required flags - c.CmdClause.Flag("name", "The name of the ACL to delete").Required().StringVar(&c.name) c.RegisterFlag(cmd.StringFlagOpts{ Name: cmd.FlagVersionName, Description: cmd.FlagVersionDesc, @@ -27,6 +26,8 @@ func NewDeleteCommand(parent cmd.Registerer, globals *config.Data, data manifest Required: true, }) + c.CmdClause.Flag("name", "The name of the ACL to delete").Required().StringVar(&c.name) + // Optional flags c.RegisterAutoCloneFlag(cmd.AutoCloneFlagOpts{ Action: c.autoClone.Set, diff --git a/pkg/commands/acl/describe.go b/pkg/commands/acl/describe.go index f241fe5f6..ffe87e10d 100644 --- a/pkg/commands/acl/describe.go +++ b/pkg/commands/acl/describe.go @@ -14,13 +14,15 @@ import ( // NewDescribeCommand returns a usable command registered under the parent. func NewDescribeCommand(parent cmd.Registerer, globals *config.Data, data manifest.Data) *DescribeCommand { - var c DescribeCommand + c := DescribeCommand{ + Base: cmd.Base{ + Globals: globals, + }, + manifest: data, + } c.CmdClause = parent.Command("describe", "Retrieve a single ACL by name for the version and service").Alias("get") - c.Globals = globals - c.manifest = data // Required flags - c.CmdClause.Flag("name", "The name of the ACL").Required().StringVar(&c.name) c.RegisterFlag(cmd.StringFlagOpts{ Name: cmd.FlagVersionName, Description: cmd.FlagVersionDesc, @@ -28,6 +30,8 @@ func NewDescribeCommand(parent cmd.Registerer, globals *config.Data, data manife Required: true, }) + c.CmdClause.Flag("name", "The name of the ACL").Required().StringVar(&c.name) + // Optional Flags c.RegisterFlagBool(cmd.BoolFlagOpts{ Name: cmd.FlagJSONName, diff --git a/pkg/commands/acl/list.go b/pkg/commands/acl/list.go index 3576af8da..d9791756f 100644 --- a/pkg/commands/acl/list.go +++ b/pkg/commands/acl/list.go @@ -15,10 +15,13 @@ import ( // NewListCommand returns a usable command registered under the parent. func NewListCommand(parent cmd.Registerer, globals *config.Data, data manifest.Data) *ListCommand { - var c ListCommand + c := ListCommand{ + Base: cmd.Base{ + Globals: globals, + }, + manifest: data, + } c.CmdClause = parent.Command("list", "List ACLs") - c.Globals = globals - c.manifest = data // Required flags c.RegisterFlag(cmd.StringFlagOpts{ diff --git a/pkg/commands/acl/update.go b/pkg/commands/acl/update.go index 04425acdd..86119213e 100644 --- a/pkg/commands/acl/update.go +++ b/pkg/commands/acl/update.go @@ -13,14 +13,15 @@ import ( // NewUpdateCommand returns a usable command registered under the parent. func NewUpdateCommand(parent cmd.Registerer, globals *config.Data, data manifest.Data) *UpdateCommand { - var c UpdateCommand + c := UpdateCommand{ + Base: cmd.Base{ + Globals: globals, + }, + manifest: data, + } c.CmdClause = parent.Command("update", "Update an ACL for a particular service and version") - c.Globals = globals - c.manifest = data // Required flags - c.CmdClause.Flag("name", "The name of the ACL to update").Required().StringVar(&c.name) - c.CmdClause.Flag("new-name", "The new name of the ACL").Required().StringVar(&c.newName) c.RegisterFlag(cmd.StringFlagOpts{ Name: cmd.FlagVersionName, Description: cmd.FlagVersionDesc, @@ -28,6 +29,9 @@ func NewUpdateCommand(parent cmd.Registerer, globals *config.Data, data manifest Required: true, }) + c.CmdClause.Flag("name", "The name of the ACL to update").Required().StringVar(&c.name) + c.CmdClause.Flag("new-name", "The new name of the ACL").Required().StringVar(&c.newName) + // Optional flags c.RegisterAutoCloneFlag(cmd.AutoCloneFlagOpts{ Action: c.autoClone.Set,