-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
83 lines (66 loc) · 2.36 KB
/
Copy pathmain.go
File metadata and controls
83 lines (66 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package main
import (
"fmt"
"os"
"github.com/spf13/cobra"
"github.com/twgh/xc/build"
"github.com/twgh/xc/clone"
"github.com/twgh/xc/dl"
"github.com/twgh/xc/dlldl"
"github.com/twgh/xc/get"
"github.com/twgh/xc/getskill"
"github.com/twgh/xc/res"
"github.com/twgh/xc/zipdl"
)
func main() {
var rootCmd = &cobra.Command{
Use: "xc",
Short: "xc 是一个 xcgui 助手类型的命令行工具",
Long: `xc 是一个 xcgui 助手类型的命令行工具, 功能包括给项目添加 xcgui、编译程序、给程序添加 Windows 资源 / 版本信息 / 程序清单、下载 xcgui 和 xcgui-example 仓库的源码、下载 xcgui.dll 文件, 克隆任意 GitHub 仓库, 从链接下载文件, 下载 go-xcgui-dev 技能。
使用方法:
xc [command]
可用命令:
get 执行 go get -u github.com/twgh/xcgui
build 执行 go build -ldflags="-s -w -H windowsgui" -trimpath
zipdl 下载并解压 xcgui 和 xcgui-example 仓库的源码 ZIP,自动选择可用代理
clone 克隆任意 GitHub 仓库,自动选择可用代理
dl 从链接下载文件,如果是 GitHub 文件会自动选择可用代理
dlldl 下载 xcgui.dll 文件
getskill 下载 go-xcgui-dev 技能
res 执行 go-winres 命令(添加 Windows 资源 / 版本信息 / 程序清单)
version 显示版本信息
help 显示命令帮助信息
使用 "xc [command] --help" 获取更多关于某个命令的信息。`,
}
// 添加版本命令
var versionCmd = &cobra.Command{
Use: "version",
Short: "显示版本信息",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("xc version 0.0.7")
},
}
// 添加 DLL 下载命令
rootCmd.AddCommand(dlldl.NewCommand())
// 添加 ZIP 下载命令
rootCmd.AddCommand(zipdl.NewCommand())
// 添加 get 命令
rootCmd.AddCommand(get.NewCommand())
// 添加 build 命令
rootCmd.AddCommand(build.NewCommand())
// 添加 clone 命令
rootCmd.AddCommand(clone.NewCommand())
// 添加 dl 命令
rootCmd.AddCommand(dl.NewCommand())
// 添加 getskill 命令
rootCmd.AddCommand(getskill.NewCommand())
// 添加 res 命令(转发 go-winres)
rootCmd.AddCommand(res.NewCommand())
// 添加版本命令
rootCmd.AddCommand(versionCmd)
// 执行根命令
if err := rootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}