add GetOrDefault functionality to config

This commit is contained in:
nate smith 2022-01-11 14:56:58 -06:00
parent eaa64df801
commit 562f1b3d0d
33 changed files with 116 additions and 58 deletions

View file

@ -15,7 +15,7 @@ import (
)
type iconfig interface {
Get(string, string) (string, error)
GetOrDefault(string, string) (string, error)
Set(string, string, string) error
Write() error
}
@ -147,7 +147,7 @@ func Login(opts *LoginOptions) error {
var username string
if userValidated {
username, _ = cfg.Get(hostname, "user")
username, _ = cfg.GetOrDefault(hostname, "user")
} else {
apiClient := api.NewClientFromHTTP(httpClient)
var err error