IsOurs returns true if the helper command is the GitHub CLI credential helper
()
| 76 | |
| 77 | // IsOurs returns true if the helper command is the GitHub CLI credential helper |
| 78 | func (h Helper) IsOurs() bool { |
| 79 | if !strings.HasPrefix(h.Cmd, "!") { |
| 80 | return false |
| 81 | } |
| 82 | |
| 83 | args, err := shlex.Split(h.Cmd[1:]) |
| 84 | if err != nil || len(args) == 0 { |
| 85 | return false |
| 86 | } |
| 87 | |
| 88 | return strings.TrimSuffix(filepath.Base(args[0]), ".exe") == "gh" |
| 89 | } |
| 90 | |
| 91 | // ConfiguredHelper returns the configured git credential helper for a given hostname. |
| 92 | func (hc *HelperConfig) ConfiguredHelper(hostname string) (Helper, error) { |