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)
| 9 | // It takes a string argument 'cmd' which represents the command to check. |
| 10 | // It returns true if the command is found, otherwise false. |
| 11 | func 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. |
no outgoing calls