mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
cli: add config and images command
Extends the existing zot CLI to add commands for listing all images and their details on a zot server. Listing all images introduces the need for configurations. Each configuration has a name and URL at the least. Check 'zot config -h' for more details. The user can specify the URL of zot server explicitly while running the command or configure a URL and pass it directly. Adding a configuration: zot config add aci-zot <zot-url> Run 'zot config --help' for more. Listing all images: zot images --url <zot-url> Pass a config instead of the url: zot images <config-name> Filter the list of images by image name: zot images <config-name> --name <image-name> Run 'zot images --help' for all details - Stores configurations in '$HOME/.zot' file Add CLI README
This commit is contained in:
+5
-1
@@ -19,7 +19,7 @@ func metadataConfig(md *mapstructure.Metadata) viper.DecoderConfigOption {
|
||||
}
|
||||
}
|
||||
|
||||
func NewRootCmd() *cobra.Command {
|
||||
func NewRootCmd(configPath string) *cobra.Command {
|
||||
showVersion := false
|
||||
config := api.NewConfig()
|
||||
|
||||
@@ -96,6 +96,10 @@ func NewRootCmd() *cobra.Command {
|
||||
|
||||
rootCmd.AddCommand(serveCmd)
|
||||
rootCmd.AddCommand(gcCmd)
|
||||
|
||||
rootCmd.AddCommand(NewConfigCommand(configPath))
|
||||
rootCmd.AddCommand(NewImageCommand(NewImageSearchService(), configPath))
|
||||
|
||||
rootCmd.Flags().BoolVarP(&showVersion, "version", "v", false, "show the version and exit")
|
||||
|
||||
return rootCmd
|
||||
|
||||
Reference in New Issue
Block a user