ソースを参照

CurrentUser only use global when needed

by needed: when host flag was supplied, matches that configured and a
user is set in config as well. they should be a pair.
pull/36/head
Rob Loranger 4年前
コミット
55dcf5e79c
この署名に対応する既知のキーがデータベースに存在しません GPGキーID: D6F1633A4F0903B8
1個のファイルの変更8行の追加1行の削除
  1. +8
    -1
      config/user.go

+ 8
- 1
config/user.go ファイルの表示

@@ -147,10 +147,17 @@ func CurrentUser(c *cli.Context) (string, error) {
}
if cfg.Default.User == "" {
// Load app-level config
cfg, err = LoadConfig(UserDataDir(c.App.ExtraInfo()["configDir"]))
globalCFG, err := LoadConfig(UserDataDir(c.App.ExtraInfo()["configDir"]))
if err != nil {
return "", err
}
// only user global defaults when both are set and hosts match
if globalCFG.Default.User != "" &&
globalCFG.Default.Host != "" &&
c.GlobalIsSet("host") &&
globalCFG.Default.Host == c.GlobalString("host") {
cfg = globalCFG
}
}

// Use user flag value


読み込み中…
キャンセル
保存