Skip to content

Commit cd6336b

Browse files
committed
Add version command
1 parent 0353045 commit cd6336b

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
test
2+
dist

.goreleaser.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
build:
22
main: main.go
33
binary: create-project
4+
ldflags: -s -w -X main.version={{.Version}}
45
goos:
56
- darwin
67
- linux

main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,28 @@ package main
33
import (
44
"log"
55
"os"
6+
"strings"
67

78
"github.com/frozzare/create-project/project"
89
)
910

11+
var version = "master"
12+
1013
func main() {
14+
log.SetFlags(0)
15+
log.SetOutput(os.Stderr)
16+
1117
if len(os.Args) < 2 {
1218
log.Fatal("No source url or directory")
1319
}
1420

1521
src := os.Args[1]
1622

23+
if strings.ToLower(src) == "version" {
24+
log.Printf("create-project version %s\n", version)
25+
return
26+
}
27+
1728
path, err := os.Getwd()
1829
if err != nil {
1930
log.Fatal(err)

0 commit comments

Comments
 (0)