splitted one operator module to file, account, image operators; splitted operator functions; etc
This commit is contained in:
@@ -54,8 +54,8 @@ func (util *FileUtil) deleteCollection(common *CommonFileParams, params *DeleteC
|
||||
}
|
||||
ref.SetUserinfo(common.Username, common.Password)
|
||||
mw := filecli.NewBasicAuthMiddleware(ref.Userinfo())
|
||||
ref.PathType(pathType(params.Regexp, params.Prefix))
|
||||
ref.DryRun(params.DryRun)
|
||||
ref.PathType(pathType(params.Regexp, params.Prefix))
|
||||
ref.DryRun(params.DryRun)
|
||||
cli := filecli.NewClient(nil, mw)
|
||||
list, err := cli.DeleteCollection(ctx, ref.Raw())
|
||||
if err != nil {
|
||||
|
||||
@@ -68,9 +68,9 @@ func (util *FileUtil) importFiles(common *CommonFileParams, params *ImportFilesP
|
||||
putErrors = append(putErrors, err)
|
||||
return nil
|
||||
}
|
||||
ref.JoinResource(relpath)
|
||||
//fmt.Printf("====%s %s\n", relpath, ref.Raw())
|
||||
//return nil
|
||||
ref.JoinResource(relpath)
|
||||
//fmt.Printf("====%s %s\n", relpath, ref.Raw())
|
||||
//return nil
|
||||
file, err := os.OpenFile(walkpath, os.O_RDONLY, 0)
|
||||
if err != nil {
|
||||
putErrors = append(putErrors, err)
|
||||
@@ -100,10 +100,10 @@ func (util *FileUtil) importFiles(common *CommonFileParams, params *ImportFilesP
|
||||
}
|
||||
return nil
|
||||
}
|
||||
err = filepath.Walk(params.Source, walcFunc)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
err = filepath.Walk(params.Source, walcFunc)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
|
||||
for _, item := range putErrors {
|
||||
err = errors.Join(err, item)
|
||||
|
||||
@@ -49,7 +49,7 @@ func (util *FileUtil) listCollections(common *CommonFileParams, params *ListColl
|
||||
return res, err
|
||||
}
|
||||
ref.SetUserinfo(common.Username, common.Password)
|
||||
ref.PathType(pathType(params.Regexp, params.Prefix))
|
||||
ref.PathType(pathType(params.Regexp, params.Prefix))
|
||||
mw := filecli.NewBasicAuthMiddleware(ref.Userinfo())
|
||||
cli := filecli.NewClient(nil, mw)
|
||||
list, err := cli.ListCollections(ctx, ref.Raw())
|
||||
|
||||
@@ -12,8 +12,8 @@ package filecmd
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
@@ -50,7 +50,7 @@ func (util *FileUtil) listFiles(common *CommonFileParams, params *ListFilesParam
|
||||
return res, err
|
||||
}
|
||||
ref.SetUserinfo(common.Username, common.Password)
|
||||
ref.PathType(pathType(params.Regexp, params.Prefix))
|
||||
ref.PathType(pathType(params.Regexp, params.Prefix))
|
||||
mw := filecli.NewBasicAuthMiddleware(ref.Userinfo())
|
||||
|
||||
cli := filecli.NewClient(nil, mw)
|
||||
@@ -58,7 +58,7 @@ func (util *FileUtil) listFiles(common *CommonFileParams, params *ListFilesParam
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
fmt.Printf("====%s\n", list)
|
||||
fmt.Printf("====%s\n", list)
|
||||
files := descr.NewFiles()
|
||||
err = json.Unmarshal(list, files.ArrayPtr())
|
||||
if err != nil {
|
||||
@@ -73,12 +73,12 @@ func (util *FileUtil) listFiles(common *CommonFileParams, params *ListFilesParam
|
||||
}
|
||||
|
||||
func pathType(regex, prefix bool) string {
|
||||
switch {
|
||||
case regex:
|
||||
return filecli.PathTypeRegexp
|
||||
case prefix:
|
||||
return filecli.PathTypePrefix
|
||||
default:
|
||||
}
|
||||
return filecli.PathTypeIdentic
|
||||
switch {
|
||||
case regex:
|
||||
return filecli.PathTypeRegexp
|
||||
case prefix:
|
||||
return filecli.PathTypePrefix
|
||||
default:
|
||||
}
|
||||
return filecli.PathTypeIdentic
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user