working commit

This commit is contained in:
2026-03-13 19:02:42 +02:00
parent bebbf79c7a
commit 5c1da77f4c
1329 changed files with 314708 additions and 39 deletions
+14 -10
View File
@@ -11,6 +11,7 @@ package filecmd
import (
"context"
"io"
"os"
"path/filepath"
"time"
@@ -38,17 +39,20 @@ type GetFileResult struct{}
func (util *FileUtil) getFile(common *CommonFileParams, params *GetFileParams) (*GetFileResult, error) {
var err error
res := &GetFileResult{}
err = os.MkdirAll(filepath.Dir(params.Dest), 0750)
if err != nil {
return res, err
var file io.Writer
if params.Dest == "-" {
file = os.Stdout
} else {
err = os.MkdirAll(filepath.Dir(params.Dest), 0750)
if err != nil {
return res, err
}
file, err := os.OpenFile(params.Dest, os.O_WRONLY|os.O_CREATE, 0640)
if err != nil {
return res, err
}
defer file.Close()
}
file, err := os.OpenFile(params.Dest, os.O_WRONLY|os.O_CREATE, 0640)
if err != nil {
return res, err
}
defer file.Close()
timeout := time.Duration(common.Timeout) * time.Second
ctx, _ := context.WithTimeout(context.Background(), timeout)
ref, err := filecli.ParsePath(params.Source)
-2
View File
@@ -12,7 +12,6 @@ package filecmd
import (
"context"
"encoding/json"
"fmt"
"time"
"github.com/spf13/cobra"
@@ -58,7 +57,6 @@ func (util *FileUtil) listFiles(common *CommonFileParams, params *ListFilesParam
if err != nil {
return res, err
}
fmt.Printf("====%s\n", list)
files := descr.NewFiles()
err = json.Unmarshal(list, files.ArrayPtr())
if err != nil {