MCPcopy
hub / github.com/pocketbase/pocketbase / updateCmd

Method updateCmd

plugins/ghupdate/ghupdate.go:116–155  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

114}
115
116func (p *plugin) updateCmd() *cobra.Command {
117 var withBackup bool
118
119 command := &cobra.Command{
120 Use: "update",
121 Short: "Automatically updates the current app executable with the latest available version",
122 SilenceUsage: true,
123 RunE: func(command *cobra.Command, args []string) error {
124 var needConfirm bool
125 if isMaybeRunningInDocker() {
126 needConfirm = true
127 color.Yellow("NB! It seems that you are in a Docker container.")
128 color.Yellow("The update command may not work as expected in this context because usually the version of the app is managed by the container image itself.")
129 } else if isMaybeRunningInNixOS() {
130 needConfirm = true
131 color.Yellow("NB! It seems that you are in a NixOS.")
132 color.Yellow("Due to the non-standard filesystem implementation of the environment, the update command may not work as expected.")
133 }
134
135 if needConfirm {
136 confirm := osutils.YesNoPrompt("Do you want to proceed with the update?", false)
137 if !confirm {
138 fmt.Println("The command has been cancelled.")
139 return nil
140 }
141 }
142
143 return p.update(withBackup)
144 },
145 }
146
147 command.PersistentFlags().BoolVar(
148 &withBackup,
149 "backup",
150 true,
151 "Creates a pb_data backup at the end of the update process",
152 )
153
154 return command
155}
156
157func (p *plugin) update(withBackup bool) error {
158 color.Yellow("Fetching release information...")

Callers 1

RegisterFunction · 0.95

Calls 4

updateMethod · 0.95
YesNoPromptFunction · 0.92
isMaybeRunningInDockerFunction · 0.85
isMaybeRunningInNixOSFunction · 0.85

Tested by

no test coverage detected