+3
-1
.github/workflows/release.yaml
+3
-1
.github/workflows/release.yaml
+3
-2
cmd/atr.go
+3
-2
cmd/atr.go
···
19
"github.com/alecthomas/chroma/lexers"
20
"github.com/alecthomas/chroma/styles"
21
repo "github.com/atscan/atr/repo"
22
-
"github.com/atscan/atr/util/version"
23
"github.com/dustin/go-humanize"
24
"github.com/fatih/color"
25
"github.com/ipfs/go-cid"
···
29
"github.com/urfave/cli/v2"
30
)
31
32
func main() {
33
34
app := &cli.App{
35
Name: "atr",
36
Usage: "AT Protocol IPLD-CAR Repository toolkit",
37
-
Version: version.Version,
38
Flags: []cli.Flag{
39
&cli.StringFlag{
40
Name: "C",
···
19
"github.com/alecthomas/chroma/lexers"
20
"github.com/alecthomas/chroma/styles"
21
repo "github.com/atscan/atr/repo"
22
"github.com/dustin/go-humanize"
23
"github.com/fatih/color"
24
"github.com/ipfs/go-cid"
···
28
"github.com/urfave/cli/v2"
29
)
30
31
+
var _version string
32
+
33
func main() {
34
35
app := &cli.App{
36
Name: "atr",
37
Usage: "AT Protocol IPLD-CAR Repository toolkit",
38
+
Version: _version,
39
Flags: []cli.Flag{
40
&cli.StringFlag{
41
Name: "C",
+12
-8
util/version/version.go
+12
-8
util/version/version.go
···
4
"runtime/debug"
5
)
6
7
+
// v holds the version number.
8
+
var v string
9
10
func revision() string {
11
info, ok := debug.ReadBuildInfo()
···
19
}
20
return ""
21
}
22
+
23
+
func Version(version string) string {
24
+
if version != "" {
25
+
v = version
26
+
}
27
+
if v == "" {
28
+
v = "dev-" + revision()
29
+
}
30
+
return v
31
+
}