Skip to content

Commit

Permalink
Merge pull request #3 from chef/tduffield/add-version
Browse files Browse the repository at this point in the history
  • Loading branch information
tduffield authored Jan 14, 2021
2 parents 62b1765 + 2c210c4 commit 34997f3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ results/
build/
.vscode/

# goreleaser
# goreleaser
dist/

# releases
go-binaries/
*.zip
*.tar.gz
*.tar.gz
file-mod
2 changes: 2 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ builds:
- id: "file-mod"
binary: file-mod
main: main.go
ldflags:
- -s -w -X github.com/chef/file-mod/commands.version={{.Version}}
env:
- CGO_ENABLED=0
goos:
Expand Down
7 changes: 7 additions & 0 deletions commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,22 @@ import (
)

var (
version string

fs filesystem.FileSystem

rootCmd = &cobra.Command{
Use: "file-mod",
Short: "Command line utility to modify files.",
SilenceUsage: true,
Version: version,
}
)

func init() {
rootCmd.SetVersionTemplate("{{.Version}}\n")
}

// Execute handles the execution of child commands and flags.
func Execute() {
fs = filesystem.NewOsFs()
Expand Down
Binary file removed file-mod
Binary file not shown.

0 comments on commit 34997f3

Please sign in to comment.