Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions cli/cmd/customer_archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import (
)

func (r *runners) InitCustomersArchiveCommand(parent *cobra.Command) *cobra.Command {
var (
customer string
app string
)
var customer string

cmd := &cobra.Command{
Use: "archive <customer_name_or_id>",
Expand Down Expand Up @@ -43,18 +40,18 @@ replicated customer archive --app myapp "Acme Inc"`,
customers = args
}

return r.archiveCustomer(cmd, customers, app)
return r.archiveCustomer(customers)
},
SilenceUsage: true,
}
parent.AddCommand(cmd)
cmd.Flags().StringVar(&customer, "customer", "", "The Customer Name or ID to archive")
cmd.Flags().MarkHidden("customer")
cmd.Flags().StringVar(&app, "app", "", "The app to archive the customer in (not required when using a customer id)")
// Local --app flag removed - will use global flag from parent

return cmd
}
func (r *runners) archiveCustomer(cmd *cobra.Command, customers []string, app string) error {
func (r *runners) archiveCustomer(customers []string) error {
if !r.hasApp() {
return errors.New("no app specified")
}
Expand All @@ -81,7 +78,7 @@ func (r *runners) archiveCustomer(cmd *cobra.Command, customers []string, app st

if c == nil {
// try to get the customer as if we have a name
cc, err := r.api.GetCustomerByName(app, customer)
cc, err := r.api.GetCustomerByName(r.appID, customer)
if err != nil {
return errors.Wrapf(err, "find customer %q", customer)
}
Expand Down
Loading