30 lines
692 B
Go
30 lines
692 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// addAcmeSubcommands acme的相关任务
|
|
func addAcmeSubcommands(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)
|
|
}
|