diff --git a/.gitignore b/.gitignore index 9daeafb..0fc18a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ test +dist diff --git a/.goreleaser.yml b/.goreleaser.yml index 263892d..6d6dc8c 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,6 +1,7 @@ build: main: main.go binary: create-project + ldflags: -s -w -X main.version={{.Version}} goos: - darwin - linux diff --git a/main.go b/main.go index 25d5d82..a89e31e 100644 --- a/main.go +++ b/main.go @@ -3,17 +3,28 @@ package main import ( "log" "os" + "strings" "github.com/frozzare/create-project/project" ) +var version = "master" + func main() { + log.SetFlags(0) + log.SetOutput(os.Stderr) + if len(os.Args) < 2 { log.Fatal("No source url or directory") } src := os.Args[1] + if strings.ToLower(src) == "version" { + log.Printf("create-project version %s\n", version) + return + } + path, err := os.Getwd() if err != nil { log.Fatal(err)