MCPcopy Create free account
hub / github.com/algolia/cli / NewUpdateCmd

Function NewUpdateCmd

pkg/cmd/application/update/update.go:28–64  ·  view source on GitHub ↗
(f *cmdutil.Factory)

Source from the content-addressed store, hash-verified

26}
27
28func NewUpdateCmd(f *cmdutil.Factory) *cobra.Command {
29 opts := &UpdateOptions{
30 IO: f.IOStreams,
31 Config: f.Config,
32 PrintFlags: cmdutil.NewPrintFlags(),
33 NewDashboardClient: func(clientID string) *dashboard.Client {
34 return dashboard.NewClient(clientID)
35 },
36 }
37
38 cmd := &cobra.Command{
39 Use: "update",
40 Short: "Rename the current Algolia application",
41 Long: heredoc.Doc(`
42 Rename the application associated with the current CLI profile.
43 Requires an active application to be selected (run "algolia application select" first).
44 `),
45 Example: heredoc.Doc(`
46 # Rename the current application
47 $ algolia application update --name "New Name"
48 `),
49 Args: validators.NoArgs(),
50 Annotations: map[string]string{
51 "skipAuthCheck": "true",
52 },
53 RunE: func(cmd *cobra.Command, args []string) error {
54 return runUpdateCmd(opts)
55 },
56 }
57
58 cmd.Flags().StringVar(&opts.Name, "name", "", "New name for the current application")
59 _ = cmd.MarkFlagRequired("name")
60
61 opts.PrintFlags.AddFlags(cmd)
62
63 return cmd
64}
65
66func runUpdateCmd(opts *UpdateOptions) error {
67 cs := opts.IO.ColorScheme()

Callers 2

NewApplicationCmdFunction · 0.92
TestNewUpdateCmdFunction · 0.70

Calls 5

NewPrintFlagsFunction · 0.92
NewClientFunction · 0.92
NoArgsFunction · 0.92
runUpdateCmdFunction · 0.70
AddFlagsMethod · 0.45

Tested by 1

TestNewUpdateCmdFunction · 0.56