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 8799131
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmd/sail/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,27 @@ 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 8799131

Please sign in to comment.