Skip to content

Commit

Permalink
chore(release): v0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Roytangrb committed Jan 16, 2021
1 parent 8f3a6d8 commit 6143178
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,7 @@ You will be prompted for selecting/entering each commit message component.
> coming soon
## Reference
* [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/)
* [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/)
* [Cobra](https://github.com/spf13/cobra)
* [Survey](https://github.com/AlecAivazis/survey)
* [Carbon](https://carbon.now.sh/)
15 changes: 10 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import (
"github.com/spf13/viper"
)

// VersionTmpl version template for --version output
const VersionTmpl = `
{{- .Name}} {{.Version}}
`

var (
cfgFile string
isVerbose bool
Expand All @@ -20,7 +25,7 @@ var logger *util.Logger = util.InitLogger(os.Stdout, os.Stdout, os.Stdout, os.St
// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "gitwok",
Version: "v0.1.0",
Version: "v0.1.2",
Short: "Configurable CLI with conventional commits, changelog, git hooks all in one",
Run: func(cmd *cobra.Command, args []string) {},
}
Expand All @@ -34,7 +39,7 @@ func Execute() {
func init() {
cobra.OnInitialize(initConfig)

rootCmd.SetVersionTemplate("{{.Name}} {{.Version}}\n")
rootCmd.SetVersionTemplate(VersionTmpl)

rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is ./gitwok.yaml)")
rootCmd.PersistentFlags().BoolVarP(&isVerbose, "verbose", "v", false, "verbose output")
Expand Down Expand Up @@ -65,11 +70,11 @@ func initConfig() {
logger.Verbose("Using config file", viper.ConfigFileUsed())
} else {
if fnfe, ok := err.(viper.ConfigFileNotFoundError); ok {
logger.Error(fnfe)
logger.Warn(fnfe)
} else if pe, ok := err.(viper.ConfigParseError); ok {
logger.Error(pe)
logger.Warn(pe)
} else {
logger.Error(err)
logger.Warn(err)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ func init() {
}

func printlnVer(name string, semver string) {
fmt.Printf("%s %s\n", name, semver)
fmt.Print(fmt.Sprintln(name, semver))
}

0 comments on commit 6143178

Please sign in to comment.