@@ -22,11 +22,15 @@ func getAttributeNamespace(cmd *cobra.Command, args []string) {
2222 h := common .NewHandler (c )
2323 defer h .Close ()
2424
25- id := c .Flags .GetRequiredID ("id" )
25+ // Load from the mutually exclusive flags
26+ identifier := c .FlagHelper .GetOptionalString ("id" )
27+ if identifier == "" {
28+ identifier = c .FlagHelper .GetOptionalString ("fqn" )
29+ }
2630
27- ns , err := h .GetNamespace (cmd .Context (), id )
31+ ns , err := h .GetNamespace (cmd .Context (), identifier )
2832 if err != nil {
29- errMsg := fmt .Sprintf ("Failed to get namespace (%s)" , id )
33+ errMsg := fmt .Sprintf ("Failed to get namespace (%s)" , identifier )
3034 cli .ExitWithError (errMsg , err )
3135 }
3236
@@ -324,12 +328,21 @@ func initNamespacesCommands() {
324328 getCmd := man .Docs .GetCommand ("policy/attributes/namespaces/get" ,
325329 man .WithRun (getAttributeNamespace ),
326330 )
331+ flags := []string {"fqn" , "id" }
327332 getCmd .Flags ().StringP (
328333 getCmd .GetDocFlag ("id" ).Name ,
329334 getCmd .GetDocFlag ("id" ).Shorthand ,
330335 getCmd .GetDocFlag ("id" ).Default ,
331336 getCmd .GetDocFlag ("id" ).Description ,
332337 )
338+ getCmd .Flags ().StringP (
339+ getCmd .GetDocFlag ("fqn" ).Name ,
340+ getCmd .GetDocFlag ("fqn" ).Shorthand ,
341+ getCmd .GetDocFlag ("fqn" ).Default ,
342+ getCmd .GetDocFlag ("fqn" ).Description ,
343+ )
344+ getCmd .MarkFlagsMutuallyExclusive (flags ... )
345+ getCmd .MarkFlagsOneRequired (flags ... )
333346
334347 listCmd := man .Docs .GetCommand ("policy/attributes/namespaces/list" ,
335348 man .WithRun (listAttributeNamespaces ),
0 commit comments