Skip to content

Commit 05cffbc

Browse files
committed
feat app version
1 parent 23c7d04 commit 05cffbc

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

cmd/fti/main.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ package main
33
import (
44
"context"
55
"flag"
6+
"fmt"
67
"log"
78
"path/filepath"
89
"time"
910

1011
"cloud.google.com/go/firestore"
1112
_ "github.com/BurntSushi/toml"
13+
"github.com/go-generalize/fti/common"
1214
"github.com/go-generalize/fti/pkg/config"
1315
"github.com/go-generalize/fti/pkg/files"
1416
"github.com/go-generalize/fti/pkg/inserter"
@@ -21,12 +23,18 @@ import (
2123
)
2224

2325
var (
24-
configPath = flag.String("c", "config.yaml", "-c config.yaml")
26+
configPath = flag.String("c", "config.yaml", "-c config.yaml")
27+
versionFlag = flag.Bool("v", false, "show version")
2528
)
2629

2730
func main() {
2831
flag.Parse()
2932

33+
if *versionFlag {
34+
fmt.Println(common.AppVersion)
35+
return
36+
}
37+
3038
if !files.Exists(*configPath) {
3139
configFullPath, _ := filepath.Abs(*configPath)
3240
log.Fatalf("not found configuration file: %s", configFullPath)

common/meta.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Package common ...
2+
package common
3+
4+
// AppVersion is a version number for this module.
5+
var AppVersion = "devel"

0 commit comments

Comments
 (0)