Skip to content

Commit

Permalink
remove viper
Browse files Browse the repository at this point in the history
  • Loading branch information
wwsean08 committed May 10, 2023
1 parent 3a6b021 commit d9362b0
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 520 deletions.
30 changes: 0 additions & 30 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package cmd

import (
"fmt"
"github.com/spf13/cobra"
"os"

"github.com/spf13/viper"
)

var cfgFile string
Expand All @@ -32,8 +28,6 @@ func Execute() {
}

func init() {
cobra.OnInitialize(initConfig)

// Here you will define your flags and configuration settings.
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.
Expand All @@ -44,27 +38,3 @@ func init() {
// when this action is called directly.
rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}

// initConfig reads in config file and ENV variables if set.
func initConfig() {
if cfgFile != "" {
// Use config file from the flag.
viper.SetConfigFile(cfgFile)
} else {
// Find home directory.
home, err := os.UserHomeDir()
cobra.CheckErr(err)

// Search config in home directory with name ".gh-status" (without extension).
viper.AddConfigPath(home)
viper.SetConfigType("yaml")
viper.SetConfigName(".gh-status")
}

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

// If a config file is found, read it in.
if err := viper.ReadInConfig(); err == nil {
fmt.Fprintln(os.Stderr, "Using config file:", viper.ConfigFileUsed())
}
}
18 changes: 1 addition & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,9 @@ module github.com/wwsean08/gh-status

go 1.20

require (
github.com/spf13/cobra v1.7.0
github.com/spf13/viper v1.15.0
)
require github.com/spf13/cobra v1.7.0

require (
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit d9362b0

Please # to comment.