@@ -121,10 +121,6 @@ func NewCmdSet(f *cmdutil.Factory, runF func(*SetOptions) error) *cobra.Command
121121 return cmdutil .FlagErrorf ("`--visibility` is only supported with `--org`" )
122122 }
123123
124- if opts .Visibility != shared .All && opts .Visibility != shared .Private && opts .Visibility != shared .Selected {
125- return cmdutil .FlagErrorf ("`--visibility` must be one of \" all\" , \" private\" , or \" selected\" " )
126- }
127-
128124 if opts .Visibility != shared .Selected && len (opts .RepositoryNames ) > 0 {
129125 return cmdutil .FlagErrorf ("`--repos` is only supported with `--visibility=selected`" )
130126 }
@@ -149,7 +145,7 @@ func NewCmdSet(f *cmdutil.Factory, runF func(*SetOptions) error) *cobra.Command
149145 cmd .Flags ().StringVarP (& opts .OrgName , "org" , "o" , "" , "Set `organization` secret" )
150146 cmd .Flags ().StringVarP (& opts .EnvName , "env" , "e" , "" , "Set deployment `environment` secret" )
151147 cmd .Flags ().BoolVarP (& opts .UserSecrets , "user" , "u" , false , "Set a secret for your user" )
152- cmd . Flags (). StringVarP ( & opts .Visibility , "visibility" , "v" , "private" , "Set visibility for an organization secret: `{all|private|selected}` " )
148+ cmdutil . StringEnumFlag ( cmd , & opts .Visibility , "visibility" , "v" , shared . Private , [] string { shared . All , shared . Private , shared . Selected }, "Set visibility for an organization secret" )
153149 cmd .Flags ().StringSliceVarP (& opts .RepositoryNames , "repos" , "r" , []string {}, "List of `repositories` that can access an organization or user secret" )
154150 cmd .Flags ().StringVarP (& opts .Body , "body" , "b" , "" , "The value for the secret (reads from standard input if not specified)" )
155151 cmd .Flags ().BoolVar (& opts .DoNotStore , "no-store" , false , "Print the encrypted, base64-encoded value instead of storing it on Github" )
0 commit comments