36 lines
768 B
Go
36 lines
768 B
Go
package cmd
|
||
|
||
import (
|
||
"fmt"
|
||
"os"
|
||
|
||
"archgrid.xyz/ag/tools/cmd/rsa"
|
||
"github.com/spf13/cobra"
|
||
)
|
||
|
||
var rootCmd = &cobra.Command{
|
||
Use: "agtools",
|
||
Short: "AGTools是一个基于ag_toolsbox开发的工具集合",
|
||
Long: `AGTools是一个基于ag_toolsbox开发的工具集合,主要提供了常用加密、散列、时间生成、随机字符串生成等方法。`,
|
||
}
|
||
|
||
var versionCommand = &cobra.Command{
|
||
Use: "version",
|
||
Short: "输出当前工具版本号",
|
||
Run: func(cmd *cobra.Command, args []string) {
|
||
fmt.Println("AGTools v0.0.1")
|
||
},
|
||
}
|
||
|
||
func init() {
|
||
rootCmd.AddCommand(versionCommand)
|
||
rootCmd.AddCommand(rsa.GetRsaCmd())
|
||
}
|
||
|
||
func Execute() {
|
||
if err := rootCmd.Execute(); err != nil {
|
||
fmt.Printf("无法执行命令: %s\n", err)
|
||
os.Exit(1)
|
||
}
|
||
}
|