Skip to content

Commit

Permalink
Merge pull request #5 from buty4649/fix-version-str
Browse files Browse the repository at this point in the history
Update version formatting in Execute function
  • Loading branch information
buty4649 authored Mar 18, 2024
2 parents d810cc5 + bee5df3 commit 18c72b7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ SOFTWARE.
package cmd

import (
"fmt"
"log/slog"
"os"

Expand All @@ -42,7 +43,6 @@ var ip *iproute2.Iproute2

var rootCmd = &cobra.Command{
Use: "netnsplan",
Version: version.Version,
Short: "Easily automate Linux netns networks and configurations via YAML",
Long: "Easily automate Linux netns networks and configurations via YAML",
SilenceUsage: true,
Expand All @@ -69,6 +69,12 @@ var rootCmd = &cobra.Command{
}

func Execute() {
if version.Version != "dev" {
rootCmd.Version = fmt.Sprintf("v%s", version.Version)
} else {
rootCmd.Version = version.Version
}

err := rootCmd.Execute()
if err != nil {
os.Exit(1)
Expand Down

0 comments on commit 18c72b7

Please sign in to comment.