Skip to content

Commit

Permalink
add version flag
Browse files Browse the repository at this point in the history
  • Loading branch information
theblackturtle committed Feb 7, 2020
1 parent 6a9b955 commit d981d45
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package core
const (
CLIName = "gospider"
AUTHOR = "@theblackturtle"
VERSION = "v1.0.2"
VERSION = "v1.0.3"
)
7 changes: 7 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func main() {
commands.Flags().BoolP("debug", "", false, "Turn on debug mode")
commands.Flags().BoolP("verbose", "v", false, "Turn on verbose")
commands.Flags().BoolP("no-redirect", "", false, "Disable redirect")
commands.Flags().BoolP("version", "", false, "Check version")

commands.Flags().SortFlags = false
if err := commands.Execute(); err != nil {
Expand All @@ -60,6 +61,12 @@ func run(cmd *cobra.Command, args []string) {
os.Exit(1)
}

version, _ := cmd.Flags().GetBool("version")
if version{
fmt.Printf("Version: %s",core.VERSION)
os.Exit(0)
}

isDebug, _ := cmd.Flags().GetBool("debug")
if isDebug {
core.Logger.SetLevel(logrus.DebugLevel)
Expand Down

0 comments on commit d981d45

Please sign in to comment.