Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8612825

Browse files
committed
feat(cli): improve update command to add force flag and alias to restart
1 parent591cefa commit8612825

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

‎cli/update.go‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
func (r*RootCmd)update()*serpent.Command {
1313
var (
14+
forcebool
1415
parameterFlagsworkspaceParameterFlags
1516
bflagsbuildFlags
1617
)
@@ -29,6 +30,19 @@ func (r *RootCmd) update() *serpent.Command {
2930
iferr!=nil {
3031
returnerr
3132
}
33+
34+
// update command with --force flag is used as an alias for restart.
35+
// It can be used to update the workspace parameters for an already up-to-date workspace.
36+
ifforce {
37+
_,_=fmt.Fprintf(inv.Stdout,"Restarting %s to update the workspace parameters.\n",workspace.Name)
38+
returnr.restart().Handler(inv)
39+
}
40+
41+
if!workspace.Outdated&&len(parameterFlags.richParameters)!=0 {
42+
_,_=fmt.Fprintf(inv.Stdout,"Workspace is up-to-date. Please add --force to update the workspace parameters.\n")
43+
returnnil
44+
}
45+
3246
if!workspace.Outdated&&!parameterFlags.promptRichParameters&&!parameterFlags.promptEphemeralParameters&&len(parameterFlags.ephemeralParameters)==0 {
3347
_,_=fmt.Fprintf(inv.Stdout,"Workspace is up-to-date.\n")
3448
returnnil
@@ -57,5 +71,11 @@ func (r *RootCmd) update() *serpent.Command {
5771

5872
cmd.Options=append(cmd.Options,parameterFlags.allOptions()...)
5973
cmd.Options=append(cmd.Options,bflags.cliOptions()...)
74+
75+
cmd.Options=append(cmd.Options, serpent.Option{
76+
Flag:"force",
77+
Description:"Force the update of the workspace even if it is up-to-date.",
78+
Value:serpent.BoolOf(&force),
79+
})
6080
returncmd
6181
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp