Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

Commit

Permalink
remove primary color concept
Browse files Browse the repository at this point in the history
  • Loading branch information
martinnirtl committed Feb 17, 2020
1 parent 65bcdba commit b1f335f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 21 deletions.
6 changes: 0 additions & 6 deletions internal/commands/configcmd/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ var setCmd = &cobra.Command{
options := []string{
fmt.Sprintf("hidesubcommandoutput: %t", viper.GetBool("hidesubcommandoutput")),
fmt.Sprintf("logfile: %s", viper.GetString("logfile")),
fmt.Sprintf("color: %s", viper.GetString("color")),
fmt.Sprintf("username: %s", viper.GetString("username")),
}

Expand Down Expand Up @@ -55,11 +54,6 @@ func setConfigVar(varname string) {

viper.Set("logfile", logfile)

case "color":
color := survey.Select("Select a new primary color", config.PrimaryColors)

viper.Set("color", color)

case "username":
username := survey.InputName("Enter new username", viper.GetString("username"))

Expand Down
2 changes: 0 additions & 2 deletions internal/commands/initcmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"path"
"time"

"github.com/martinnirtl/dockma/internal/config"
"github.com/martinnirtl/dockma/internal/survey"
"github.com/martinnirtl/dockma/internal/utils"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -50,7 +49,6 @@ func initCommandHandler(cmd *cobra.Command, args []string) {
}

username = survey.InputName("What is your name", username)
username = survey.Select("Select primary color", config.PrimaryColors)

viper.Set("username", username)
viper.Set("init", time.Now())
Expand Down
1 change: 0 additions & 1 deletion internal/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ func init() {
viper.SetDefault("username", "User")
viper.SetDefault("hidesubcommandoutput", true)
viper.SetDefault("logfile", "log.txt")
viper.SetDefault("color", "cyan")
viper.SetDefault("active", "-")
viper.SetDefault("envs", map[string]interface{}{})
}
Expand Down
16 changes: 4 additions & 12 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,18 @@ import (

// NOTE viper gets initialized in commands/root.go.

// PrimaryColors are the available options for the color config field
var PrimaryColors []string = []string{"blue", "cyan", "magenta"}

// SaveConfig indicates whether config should be saved or not
// SaveConfig indicates whether config should be saved or not.
var SaveConfig bool

// message buffers for delayed/one-time saving
// message buffers for delayed/one-time saving.
var onWriteConfigError []error = make([]error, 0)
var onWriteConfigSuccess []string = make([]string, 0)

type env struct {
name string
}

// Env provides an interface for easier access to more complex environment config
// Env provides an interface for easier access to more complex environment config.
type Env interface {
GetName() string
GetHomeDir() string
Expand All @@ -42,7 +39,7 @@ type Env interface {
GetLatest() (Profile, error)
}

// Save sets the config to be saved at end of command execution. Respective message is printed after writing config
// Save sets the config to be saved at end of command execution. Respective message is printed after writing config.
func Save(success string, err error) {
if success != "" {
onWriteConfigSuccess = append(onWriteConfigSuccess, success)
Expand Down Expand Up @@ -98,11 +95,6 @@ func GetLogfile() string {
return GetFile(filename)
}

// GetColor returns the configured primary color.
func GetColor() string {
return viper.GetString("color")
}

// GetEnvNames returns configured envs.
func GetEnvNames() (envs []string) {
envsMap := viper.GetStringMap("envs")
Expand Down

0 comments on commit b1f335f

Please sign in to comment.