MCPcopy Create free account
hub / github.com/appleboy/CodeGPT / IsCommandAvailable

Function IsCommandAvailable

util/util.go:11–14  ·  view source on GitHub ↗

IsCommandAvailable checks if a given command is available in the system's PATH. It takes a string argument 'cmd' which represents the command to check. It returns true if the command is found, otherwise false.

(cmd string)

Source from the content-addressed store, hash-verified

9// It takes a string argument 'cmd' which represents the command to check.
10// It returns true if the command is found, otherwise false.
11func IsCommandAvailable(cmd string) bool {
12 _, err := exec.LookPath(cmd)
13 return err == nil
14}
15
16// ConvertToMap takes a slice of strings in the format "key=value" and converts it into a Data map.
17// Each string in the slice is split into a key and value pair using the first occurrence of the "=" character.

Callers 2

checkFunction · 0.92
TestIsCommandAvailableFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestIsCommandAvailableFunction · 0.68