working commit

This commit is contained in:
2026-02-20 13:05:57 +02:00
parent 903a03cf89
commit dcb22b58d9
4 changed files with 37 additions and 5 deletions
+9 -1
View File
@@ -23,6 +23,7 @@ import (
"time"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"mstore/pkg/client"
"mstore/pkg/descr"
@@ -43,6 +44,13 @@ func (util *FileUtil) CreateFileCmds() *cobra.Command {
subCmd.MarkPersistentFlagRequired("host")
subCmd.MarkFlagsRequiredTogether("user", "pass")
vi := viper.New()
vi.SetEnvPrefix("mstore")
vi.BindEnv("user")
vi.BindEnv("pass")
util.commonFileParams.Username = vi.GetString("user")
util.commonFileParams.Password = vi.GetString("pass")
// PutFile
var putFileCmd = &cobra.Command{
Use: "put filepath [user:pass@]hostname[:port]/collection/name",
@@ -408,7 +416,7 @@ func (util *FileUtil) importFiles(common *CommonFileParams, params *ImportFilesP
err = client.NewClient().PutFile(ctx, walkPath, dest)
if err != nil {
putErrors = append(putErrors, err)
fmt.Printf("- %s: error\n", walkPath)
fmt.Printf("- %s: error: %v \n", walkPath, err)
} else {
res.Files = append(res.Files, walkPath)
fmt.Printf("- %s: ok\n", walkPath)