MCPcopy Index your code
hub / github.com/coder/coder / CheckCommand

Function CheckCommand

cli/gitauth/askpass.go:16–26  ·  view source on GitHub ↗

CheckCommand returns true if the command arguments and environment match those when the GIT_ASKPASS command is invoked by git.

(args, env []string)

Source from the content-addressed store, hash-verified

14// CheckCommand returns true if the command arguments and environment
15// match those when the GIT_ASKPASS command is invoked by git.
16func CheckCommand(args, env []string) bool {
17 if len(args) != 1 || (!strings.HasPrefix(args[0], "Username ") && !strings.HasPrefix(args[0], "Password ")) {
18 return false
19 }
20 for _, e := range env {
21 if strings.HasPrefix(e, "GIT_PREFIX=") {
22 return true
23 }
24 }
25 return false
26}
27
28// ParseAskpass returns the user and host from a git askpass prompt. For
29// example: "user1" and "https://github.com". Note that for HTTP

Callers 2

CommandMethod · 0.92
TestCheckCommandFunction · 0.92

Calls

no outgoing calls

Tested by 1

TestCheckCommandFunction · 0.74