ag_tools/cmd/rootCmd.go

36 lines
768 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"
"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)
}
}