working commit
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user