mirror of
https://github.com/project-zot/zot.git
synced 2026-06-19 22:27:58 +08:00
cli: move client-only code out of the server flow
earlier, some of the client exclusive code was being run on zot server instance too. cli: fix the bug: spinner is not stopped with -o
This commit is contained in:
+10
-2
@@ -1,6 +1,8 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
@@ -9,7 +11,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func NewImageCommand(searchService ImageSearchService, configPath string) *cobra.Command {
|
||||
func NewImageCommand(searchService ImageSearchService) *cobra.Command {
|
||||
searchImageParams := make(map[string]*string)
|
||||
|
||||
var servURL string
|
||||
@@ -23,6 +25,12 @@ func NewImageCommand(searchService ImageSearchService, configPath string) *cobra
|
||||
Short: "List hosted images",
|
||||
Long: `List images hosted on zot`,
|
||||
RunE: func(cmd *cobra.Command, args []string) error {
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
configPath := path.Join(home + "/.zot")
|
||||
if servURL == "" {
|
||||
if len(args) > 0 {
|
||||
urlFromConfig, err := getConfigValue(configPath, args[0], "url")
|
||||
@@ -52,7 +60,7 @@ func NewImageCommand(searchService ImageSearchService, configPath string) *cobra
|
||||
isSpinner = true
|
||||
}
|
||||
|
||||
err := searchImage(cmd, searchImageParams, searchService, &servURL, &user, &outputFormat, isSpinner)
|
||||
err = searchImage(cmd, searchImageParams, searchService, &servURL, &user, &outputFormat, isSpinner)
|
||||
|
||||
if err != nil {
|
||||
cmd.SilenceUsage = true
|
||||
|
||||
Reference in New Issue
Block a user