Skip to content

Commit

Permalink
Merge pull request #187 from vbatts/version
Browse files Browse the repository at this point in the history
*: move version from library to cmd, and generate it
  • Loading branch information
vbatts authored Mar 22, 2023
2 parents 84c498b + 6303899 commit 98ebe18
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ CLEAN_FILES += .cli.test .cli.test.tags
build: $(BUILD)

$(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:
@go install -u github.com/fatih/color@latest ; \
Expand Down
6 changes: 4 additions & 2 deletions cmd/gomtree/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@ import (
"github.com/vbatts/go-mtree"
)

var Version string

func main() {
app := cli.NewApp()
app.Name = mtree.AppName
app.Name = "gomtree"
app.Version = Version
app.Usage = "map a directory hierarchy"
app.Description = `The gomtree utility compares the file hierarchy rooted in
the current directory against a specification read from file or standard input.
Expand All @@ -26,7 +29,6 @@ hierarchy or the specification.
This tool is written in likeness to the BSD MTREE(6), with notable additions
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
app.Flags = []cli.Flag{
// Flags common with mtree(8)
Expand Down
23 changes: 0 additions & 23 deletions version.go

This file was deleted.

0 comments on commit 98ebe18

Please sign in to comment.