AT Protocol IPLD-CAR Repository toolkit (CLI)

version number

tree 078e3bab b542ac0c

Changed files
+18 -11
.github
workflows
cmd
util
version
+3 -1
.github/workflows/release.yaml
··· 28 goos: ${{ matrix.goos }} 29 goarch: ${{ matrix.goarch }} 30 project_path: "./cmd" 31 - binary_name: atr
··· 28 goos: ${{ matrix.goos }} 29 goarch: ${{ matrix.goarch }} 30 project_path: "./cmd" 31 + binary_name: atr 32 + sha256sum: true 33 + md5sum: false
+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
··· 4 "runtime/debug" 5 ) 6 7 - // Version holds the version number. 8 - var Version string 9 - 10 - func init() { 11 - if Version == "" { 12 - Version = "dev-" + revision() 13 - } 14 - } 15 16 func revision() string { 17 info, ok := debug.ReadBuildInfo() ··· 25 } 26 return "" 27 }
··· 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 + }