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

Commit1c43a1a

Browse files
committed
Merge pull requestsorintlab#221 from sgotti/stolonctl_spec_defaults_option
stolonctl: add an option to show defaults cluster spec values
2 parents31cbb41 +a16b11e commit1c43a1a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎cmd/stolonctl/spec.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,15 @@ var cmdSpec = &cobra.Command{
2626
Short:"Retrieve the current cluster specification",
2727
}
2828

29+
typespecOptionsstruct {
30+
defaultsbool
31+
}
32+
33+
varspecOptsspecOptions
34+
2935
funcinit() {
36+
cmdSpec.PersistentFlags().BoolVar(&specOpts.defaults,"defaults",false,"also show default values")
37+
3038
cmdStolonCtl.AddCommand(cmdSpec)
3139
}
3240

@@ -46,7 +54,11 @@ func spec(cmd *cobra.Command, args []string) {
4654
ifcd.Cluster.Spec==nil {
4755
die("no cluster spec available")
4856
}
49-
specj,err:=json.MarshalIndent(cd.Cluster.Spec,"","\t")
57+
cs:=cd.Cluster.Spec
58+
ifspecOpts.defaults {
59+
cs=cd.Cluster.DefSpec()
60+
}
61+
specj,err:=json.MarshalIndent(cs,"","\t")
5062
iferr!=nil {
5163
die("failed to marshall spec: %v",err)
5264
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp