Colorize function

Colorize adds colors to the output text.

Parameters:

- text: The text to colorize.

- color: The color to apply (red, green, yellow, blue, reset).

Parameters:

  • text string
  • color string

Returns:

  • string
Show/Hide Function Body
{
	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 function

SplitIgnore splits the ignore string into a slice of strings.

Parameters:

- ignore: The comma-separated ignore string.

Parameters:

  • ignore string

Returns:

  • []string
Show/Hide Function Body
{
	return strings.Split(ignore, ",")
}

StringToInt function

StringToInt converts a string to an integer.

Parameters:

- s: The string to convert.

Parameters:

  • s string

Returns:

  • int
  • error
Show/Hide Function Body
{
	return strconv.Atoi(s)
}

Reexec function

reexec restarts the process with the new arguments.

Parameters:

- args: The new arguments for the process.

Parameters:

  • args []string

Returns:

  • error
Show/Hide Function Body
{
	exe, err := os.Executable()
	if err != nil {
		return err
	}
	return syscall.Exec(exe, append([]string{exe}, args...), os.Environ())
}

os import

Import example:

import "os"

strconv import

Import example:

import "strconv"

strings import

Import example:

import "strings"

syscall import

Import example:

import "syscall"