From c8b3130e1addfb60f4b92f18235292b81275f84e Mon Sep 17 00:00:00 2001 From: zu1k Date: Fri, 17 Dec 2021 13:24:03 +0800 Subject: [PATCH] Add version flag Signed-off-by: zu1k --- README_zh-CN.md | 2 +- cmd/root.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README_zh-CN.md b/README_zh-CN.md index 090d669..27f68e3 100644 --- a/README_zh-CN.md +++ b/README_zh-CN.md @@ -44,7 +44,7 @@ ### 从源码安装 -Nali 需要预先安装 Go. 安装后可以从源码安装软件: +Nali 需要预先安装 Go >= 1.18. 安装后可以从源码安装软件: ```sh $ go install github.com/zu1k/nali diff --git a/cmd/root.go b/cmd/root.go index e6594e6..1f34da6 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -4,6 +4,8 @@ import ( "log" "os" + "github.com/zu1k/nali/internal/constant" + "github.com/spf13/cobra" "github.com/zu1k/nali/internal/app" ) @@ -50,7 +52,8 @@ Find document on: https://github.com/zu1k/nali $ nslookup google.com | nali `, - Args: cobra.MinimumNArgs(0), + Version: constant.Version, + Args: cobra.MinimumNArgs(0), Run: func(cmd *cobra.Command, args []string) { gbk, _ := cmd.Flags().GetBool("gbk") app.Root(args, gbk)