cli lint (438)

This commit is contained in:
Michael Quigley 2024-01-10 14:01:58 -05:00
parent b6629d7fb4
commit 4b7f5df1ee
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
2 changed files with 4 additions and 53 deletions

View File

@ -21,9 +21,10 @@ type copyCommand struct {
func newCopyCommand() *copyCommand {
cmd := &cobra.Command{
Use: "copy <source> [<target>] (<target> defaults to 'file://.`)",
Short: "Copy (unidirectional sync) zrok drive contents from <source> to <target> ('http://', 'file://', and 'zrok://' supported)",
Args: cobra.RangeArgs(1, 2),
Use: "copy <source> [<target>] (<target> defaults to 'file://.`)",
Short: "Copy (unidirectional sync) zrok drive contents from <source> to <target> ('http://', 'file://', and 'zrok://' supported)",
Aliases: []string{"cp"},
Args: cobra.RangeArgs(1, 2),
}
command := &copyCommand{cmd: cmd}
cmd.Run = command.run

View File

@ -1,50 +0,0 @@
package main
import (
"context"
"github.com/openziti/zrok/drives/davClient"
"github.com/spf13/cobra"
"io"
"net/http"
"os"
)
func init() {
rootCmd.AddCommand(newDavtestCommand().cmd)
}
type davtestCommand struct {
cmd *cobra.Command
}
func newDavtestCommand() *davtestCommand {
cmd := &cobra.Command{
Use: "davtest",
Short: "WebDAV testing wrapper",
Args: cobra.ExactArgs(3),
}
command := &davtestCommand{cmd: cmd}
cmd.Run = command.run
return command
}
func (cmd *davtestCommand) run(_ *cobra.Command, args []string) {
client, err := davClient.NewClient(http.DefaultClient, args[0])
if err != nil {
panic(err)
}
ws, err := client.Open(context.Background(), args[1])
if err != nil {
panic(err)
}
fs, err := os.Create(args[2])
if err != nil {
panic(err)
}
_, err = io.Copy(fs, ws)
if err != nil {
panic(err)
}
ws.Close()
fs.Close()
}