Enhance Zsh and Config Commands, Update Network Configuration
- Implemented comprehensive Zsh installation command with multiple network scenarios - Added 'config show' subcommand to display agent configuration - Updated version command to print version information - Modified Network configuration to clarify internet connectivity status - Improved download utility with additional file existence checks - Updated agent-wdd rules and documentation
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"agent-wdd/log"
|
||||
"agent-wdd/utils"
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -16,16 +19,26 @@ func addDownloadSubcommands(cmd *cobra.Command) {
|
||||
},
|
||||
}
|
||||
|
||||
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.Run = func(cmd *cobra.Command, args []string) {
|
||||
if len(args) == 0 {
|
||||
log.Error("请输入下载地址")
|
||||
return
|
||||
} else if len(args) == 1 {
|
||||
args = append(args, ".")
|
||||
}
|
||||
|
||||
log.Info("Downloading without proxy: %s -> %s\n", args[0], args[1])
|
||||
|
||||
downloadOk, resultLog := utils.DownloadFile(args[0], args[1])
|
||||
if !downloadOk {
|
||||
log.Error("下载失败: %s", resultLog)
|
||||
} else {
|
||||
log.Info("下载成功: %s", args[1])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
cmd.AddCommand(proxyCmd, unproxyCmd)
|
||||
cmd.AddCommand(proxyCmd)
|
||||
}
|
||||
|
||||
// 根据需求补充其他子命令的添加函数...
|
||||
|
||||
Reference in New Issue
Block a user