MCPcopy
hub / github.com/larksuite/cli / NewCmdUpdate

Function NewCmdUpdate

cmd/update/update.go:96–121  ·  view source on GitHub ↗

NewCmdUpdate creates the update command.

(f *cmdutil.Factory)

Source from the content-addressed store, hash-verified

94
95// NewCmdUpdate creates the update command.
96func NewCmdUpdate(f *cmdutil.Factory) *cobra.Command {
97 opts := &UpdateOptions{Factory: f}
98
99 cmd := &cobra.Command{
100 Use: "update",
101 Short: "Update lark-cli to the latest version",
102 Long: `Update lark-cli to the latest version.
103
104Detects the installation method automatically:
105 - npm install: runs npm install -g @larksuite/cli@<version>
106 - manual/other: shows GitHub Releases download URL
107
108Use --json for structured output (for AI agents and scripts).
109Use --check to only check for updates without installing.`,
110 RunE: func(cmd *cobra.Command, args []string) error {
111 return updateRun(opts)
112 },
113 }
114 cmdutil.DisableAuthCheck(cmd)
115 cmd.Flags().BoolVar(&opts.JSON, "json", false, "structured JSON output")
116 cmd.Flags().BoolVar(&opts.Force, "force", false, "force reinstall even if already up to date")
117 cmd.Flags().BoolVar(&opts.Check, "check", false, "only check for updates, do not install")
118 cmdutil.SetRisk(cmd, "high-risk-write")
119
120 return cmd
121}
122
123func updateRun(opts *UpdateOptions) error {
124 io := opts.Factory.IOStreams

Callers 15

TestUpdateManual_JSONFunction · 0.85
TestUpdateManual_HumanFunction · 0.85
TestUpdateNpm_JSONFunction · 0.85
TestUpdateNpm_HumanFunction · 0.85
TestUpdateForce_JSONFunction · 0.85

Calls 3

DisableAuthCheckFunction · 0.92
SetRiskFunction · 0.92
updateRunFunction · 0.85

Tested by 15

TestUpdateManual_JSONFunction · 0.68
TestUpdateManual_HumanFunction · 0.68
TestUpdateNpm_JSONFunction · 0.68
TestUpdateNpm_HumanFunction · 0.68
TestUpdateForce_JSONFunction · 0.68