Colorize adds colors to the output text.
Parameters:
- text: The text to colorize.
- color: The color to apply (red, green, yellow, blue, reset).
{
colors := map[string]string{
"red": "\033[31m",
"green": "\033[32m",
"yellow": "\033[33m",
"blue": "\033[34m",
"reset": "\033[0m",
}
return colors[color] + text + colors["reset"]
}
SplitIgnore splits the ignore string into a slice of strings.
Parameters:
- ignore: The comma-separated ignore string.
{
return strings.Split(ignore, ",")
}
StringToInt converts a string to an integer.
Parameters:
- s: The string to convert.
{
return strconv.Atoi(s)
}
reexec restarts the process with the new arguments.
Parameters:
- args: The new arguments for the process.
{
exe, err := os.Executable()
if err != nil {
return err
}
return syscall.Exec(exe, append([]string{exe}, args...), os.Environ())
}
import "os"
import "strconv"
import "strings"
import "syscall"