mirror of
https://github.com/vbatts/go-mtree.git
synced 2024-12-18 12:06:30 +00:00
Merge pull request #187 from vbatts/version
*: move version from library to cmd, and generate it
This commit is contained in:
commit
98ebe1868e
3 changed files with 5 additions and 26 deletions
2
Makefile
2
Makefile
|
@ -82,7 +82,7 @@ CLEAN_FILES += .cli.test .cli.test.tags
|
||||||
build: $(BUILD)
|
build: $(BUILD)
|
||||||
|
|
||||||
$(BUILD): $(SOURCE_FILES)
|
$(BUILD): $(SOURCE_FILES)
|
||||||
go build -mod=vendor -o $(BUILD) $(BUILDPATH)
|
go build -ldflags="-X 'main.Version=$(shell git describe --always --dirty)'" -mod=vendor -o $(BUILD) $(BUILDPATH)
|
||||||
|
|
||||||
install.tools:
|
install.tools:
|
||||||
@go install -u github.com/fatih/color@latest ; \
|
@go install -u github.com/fatih/color@latest ; \
|
||||||
|
|
|
@ -14,9 +14,12 @@ import (
|
||||||
"github.com/vbatts/go-mtree"
|
"github.com/vbatts/go-mtree"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var Version string
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = mtree.AppName
|
app.Name = "gomtree"
|
||||||
|
app.Version = Version
|
||||||
app.Usage = "map a directory hierarchy"
|
app.Usage = "map a directory hierarchy"
|
||||||
app.Description = `The gomtree utility compares the file hierarchy rooted in
|
app.Description = `The gomtree utility compares the file hierarchy rooted in
|
||||||
the current directory against a specification read from file or standard input.
|
the current directory against a specification read from file or standard input.
|
||||||
|
@ -26,7 +29,6 @@ hierarchy or the specification.
|
||||||
|
|
||||||
This tool is written in likeness to the BSD MTREE(6), with notable additions
|
This tool is written in likeness to the BSD MTREE(6), with notable additions
|
||||||
to support xattrs and interacting with tar archives.`
|
to support xattrs and interacting with tar archives.`
|
||||||
app.Version = mtree.Version
|
|
||||||
// cli docs --> https://github.com/urfave/cli/blob/master/docs/v2/manual.md
|
// cli docs --> https://github.com/urfave/cli/blob/master/docs/v2/manual.md
|
||||||
app.Flags = []cli.Flag{
|
app.Flags = []cli.Flag{
|
||||||
// Flags common with mtree(8)
|
// Flags common with mtree(8)
|
||||||
|
|
23
version.go
23
version.go
|
@ -1,23 +0,0 @@
|
||||||
package mtree
|
|
||||||
|
|
||||||
import "fmt"
|
|
||||||
|
|
||||||
const (
|
|
||||||
// AppName is the name ... of this library/application
|
|
||||||
AppName = "gomtree"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
// VersionMajor is for an API incompatible changes
|
|
||||||
VersionMajor = 0
|
|
||||||
// VersionMinor is for functionality in a backwards-compatible manner
|
|
||||||
VersionMinor = 5
|
|
||||||
// VersionPatch is for backwards-compatible bug fixes
|
|
||||||
VersionPatch = 1
|
|
||||||
|
|
||||||
// VersionDev indicates development branch. Releases will be empty string.
|
|
||||||
VersionDev = "-dev"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Version is the specification version that the package types support.
|
|
||||||
var Version = fmt.Sprintf("%d.%d.%d%s", VersionMajor, VersionMinor, VersionPatch, VersionDev)
|
|
Loading…
Reference in a new issue