Skip to content

Commit

Permalink
Merge pull request #20 from future-architect/add-version-file
Browse files Browse the repository at this point in the history
[add version file]
  • Loading branch information
orangekame3 authored Oct 22, 2023
2 parents b57e212 + 8456b76 commit 3696dee
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .tagpr
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@
[tagpr]
vPrefix = true
releaseBranch = main
versionFile = -
versionFile = cmd/version.go
33 changes: 33 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Package cmd is a root command.
/*
Copyright © 2023 Takafumi Miyanaga <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package cmd

import "fmt"

// Version is a version of this application.
const Version = "0.0.4"

// SetVersionInfo sets version and date to rootCmd
func SetVersionInfo(version, date string) {
rootCmd.Version = fmt.Sprintf("%s (Built on %s)", version, date)
}
5 changes: 1 addition & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ import (
"github.com/future-architect/tftarget/cmd"
)

var (
version = "0.0.4"
)

func main() {
cmd.SetVersionInfo(version, time.Now().String())
cmd.SetVersionInfo(cmd.Version, time.Now().String())
cmd.Execute()
}

0 comments on commit 3696dee

Please sign in to comment.