Skip to content

Commit

Permalink
Remove viper
Browse files Browse the repository at this point in the history
Remove dependencies
  • Loading branch information
guilhem committed Oct 30, 2019
1 parent e5d14bb commit 5448c8b
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 121 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ Available Commands:

Flags:
--allow-dirty allow usage of bump on dirty git
--config string config file (default is $HOME/.bump.yaml)
--dry-run Don't touch git repository
-h, --help help for bump
--latest-tag use latest tag, prompt tags if false (default true)
Expand Down
32 changes: 0 additions & 32 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ import (
"github.com/guilhem/bump/pkg/git"
"github.com/manifoldco/promptui"
"github.com/spf13/cobra"

homedir "github.com/mitchellh/go-homedir"
"github.com/spf13/viper"
)

var cfgFile string
Expand All @@ -50,10 +47,6 @@ func Execute() {
}

func init() {
cobra.OnInitialize(initConfig)

rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.bump.yaml)")

rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")

rootCmd.PersistentFlags().BoolVar(&allowDirty, "allow-dirty", false, "allow usage of bump on dirty git")
Expand All @@ -62,31 +55,6 @@ func init() {

}

func initConfig() {
if cfgFile != "" {
// Use config file from the flag.
viper.SetConfigFile(cfgFile)
} else {
// Find home directory.
home, err := homedir.Dir()
if err != nil {
fmt.Println(err)
os.Exit(1)
}

// Search config in home directory with name ".bump" (without extension).
viper.AddConfigPath(home)
viper.SetConfigName(".bump")
}

viper.AutomaticEnv() // read in environment variables that match

// If a config file is found, read it in.
if err := viper.ReadInConfig(); err == nil {
fmt.Println("Using config file:", viper.ConfigFileUsed())
}
}

func preRun(cmd *cobra.Command, args []string) {
g, err := git.New()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ go 1.13

require (
github.com/Masterminds/semver v1.5.0
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf // indirect
github.com/manifoldco/promptui v0.3.2
github.com/mitchellh/go-homedir v1.1.0
github.com/nicksnyder/go-i18n v1.10.1 // indirect
github.com/spf13/cobra v0.0.5
github.com/spf13/viper v1.4.0
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 // indirect
gopkg.in/alecthomas/kingpin.v3-unstable v3.0.0-20180810215634-df19058c872c // indirect
gopkg.in/src-d/go-git.v4 v4.13.1
)
Loading

0 comments on commit 5448c8b

Please sign in to comment.