Files
ProjectOctopus/agent-wdd/cmd/Download.go
2025-02-10 15:07:44 +08:00

32 lines
746 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
// 示例添加download子命令
func addDownloadSubcommands(cmd *cobra.Command) {
proxyCmd := &cobra.Command{
Use: "proxy [url] [dest]",
Short: "使用代理下载",
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("Downloading with proxy: %s -> %s\n", args[0], args[1])
},
}
unproxyCmd := &cobra.Command{
Use: "unproxy [url] [dest]",
Short: "不使用代理下载",
Args: cobra.ExactArgs(2),
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("Downloading without proxy: %s -> %s\n", args[0], args[1])
},
}
cmd.AddCommand(proxyCmd, unproxyCmd)
}
// 根据需求补充其他子命令的添加函数...