diff --git a/README.md b/README.md index f2241f7..0091877 100644 --- a/README.md +++ b/README.md @@ -414,6 +414,12 @@ defaultView = "default" v = "sort_column_24h_volume" ``` +You may specify a different config file to use by using the `-config` flag: + +```bash +cointop -config="/path/to/config" +``` + ## List of actions This are the action keywords you may use in the config file to change what the shortcut keys do. diff --git a/cointop/cointop.go b/cointop/cointop.go index f1fbee1..c89134e 100644 --- a/cointop/cointop.go +++ b/cointop/cointop.go @@ -100,6 +100,8 @@ type Config struct { ConfigFilepath string } +var defaultConfigPath = "~/.cointop/config" + // NewCointop initializes cointop func NewCointop(config *Config) *Cointop { var debug bool @@ -107,7 +109,7 @@ func NewCointop(config *Config) *Cointop { debug = true } - configFilepath := "~/.cointop/config" + configFilepath := defaultConfigPath if config != nil { if config.ConfigFilepath != "" { configFilepath = config.ConfigFilepath @@ -275,9 +277,8 @@ func Clean() { func Reset() { Clean() - homedir := userHomeDir() // default config path - configPath := fmt.Sprintf("%s%s", homedir, "/.cointop") + configPath := fmt.Sprintf("%s%s", userHomeDir(), "/.cointop") if _, err := os.Stat(configPath); !os.IsNotExist(err) { fmt.Printf("removing %s\n", configPath) if err := os.RemoveAll(configPath); err != nil {