6
0
mirror of https://github.com/grdl/git-get.git synced 2026-02-13 01:10:17 +00:00

Expand home dir path after reading config

This commit is contained in:
Grzegorz Dlugoszewski
2020-06-30 11:22:55 +02:00
parent 7b9e74f903
commit b8606568ef
6 changed files with 32 additions and 36 deletions

View File

@@ -28,7 +28,7 @@ func TestConfig(t *testing.T) {
name: "no config",
configMaker: testConfigEmpty,
key: KeyDefaultHost,
want: DefDefaultHost,
want: Defaults[KeyDefaultHost],
},
{
name: "value only in gitconfig",
@@ -108,7 +108,7 @@ func testConfigInFlag(t *testing.T) {
os.Setenv(envVarName, fromEnv)
cmd := cobra.Command{}
cmd.PersistentFlags().String(KeyDefaultHost, DefDefaultHost, "")
cmd.PersistentFlags().String(KeyDefaultHost, Defaults[KeyDefaultHost], "")
viper.BindPFlag(KeyDefaultHost, cmd.PersistentFlags().Lookup(KeyDefaultHost))
cmd.SetArgs([]string{"--" + KeyDefaultHost, fromFlag})