mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-30 02:02:43 +00:00 
			
		
		
		
	cli/namespace: add detailed flag to namespace list (#20243)
* cli/namespace: add detailed flag to namespace list * changelog
This commit is contained in:
		
							
								
								
									
										4
									
								
								changelog/20243.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								changelog/20243.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | ```release-note:improvement | ||||||
|  | cli/namespace: Add detailed flag to output additional namespace information  | ||||||
|  | such as namespace IDs and custom metadata. | ||||||
|  | ``` | ||||||
| @@ -40,7 +40,18 @@ Usage: vault namespace list [options] | |||||||
| } | } | ||||||
|  |  | ||||||
| func (c *NamespaceListCommand) Flags() *FlagSets { | func (c *NamespaceListCommand) Flags() *FlagSets { | ||||||
| 	return c.flagSet(FlagSetHTTP | FlagSetOutputFormat) | 	set := c.flagSet(FlagSetHTTP | FlagSetOutputFormat) | ||||||
|  |  | ||||||
|  | 	f := set.NewFlagSet("Command Options") | ||||||
|  |  | ||||||
|  | 	f.BoolVar(&BoolVar{ | ||||||
|  | 		Name:    "detailed", | ||||||
|  | 		Target:  &c.flagDetailed, | ||||||
|  | 		Default: false, | ||||||
|  | 		Usage:   "Print detailed information such as namespace ID.", | ||||||
|  | 	}) | ||||||
|  |  | ||||||
|  | 	return set | ||||||
| } | } | ||||||
|  |  | ||||||
| func (c *NamespaceListCommand) AutocompleteArgs() complete.Predictor { | func (c *NamespaceListCommand) AutocompleteArgs() complete.Predictor { | ||||||
| @@ -104,5 +115,9 @@ func (c *NamespaceListCommand) Run(args []string) int { | |||||||
| 		return 2 | 		return 2 | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	if c.flagDetailed && Format(c.UI) != "table" { | ||||||
|  | 		return OutputData(c.UI, secret.Data["key_info"]) | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	return OutputList(c.UI, secret) | 	return OutputList(c.UI, secret) | ||||||
| } | } | ||||||
|   | |||||||
| @@ -16,6 +16,12 @@ List all namespaces: | |||||||
| $ vault namespace list | $ vault namespace list | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  | List all namespaces with additional details such as namespace ID and custom metadata: | ||||||
|  |  | ||||||
|  | ```shell-session | ||||||
|  | $ vault namespace list -detailed | ||||||
|  | ``` | ||||||
|  |  | ||||||
| Create a namespace at the path `ns1/` with no custom metadata: | Create a namespace at the path `ns1/` with no custom metadata: | ||||||
|  |  | ||||||
| ```shell-session | ```shell-session | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jason O'Donnell
					Jason O'Donnell