Skip to content

Commit

Permalink
feat: add version flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ALX99 committed May 18, 2024
1 parent 60e9103 commit 4e956ae
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cmd/sail/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,26 @@ import (
"github.com/rs/zerolog/log"
)

var printLastWD *string
var (
printVersion *bool
printLastWD *string

version = "0.0.0-dev" // set by goreleaser
)

// init parses the command line flags
func init() {
printLastWD = flag.String("write-wd", "", "Write the last working directory to the given file")
printVersion = flag.Bool("version", false, "Print the version")
flag.Parse()
}

func main() {
if *printVersion {
fmt.Println(version)
os.Exit(0)
}

cfg, err := config.GetConfig()
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
Expand Down

0 comments on commit 4e956ae

Please sign in to comment.