Hunter0x7c7
2022-08-11 b8230139fb40edea387617b6accd8371e37eda58
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package base
 
import (
    "os"
    "path"
)
 
// CommandEnvHolder is a struct holds the environment info of commands
type CommandEnvHolder struct {
    // Excutable name of current binary
    Exec string
    // commands column width of current command
    CommandsWidth int
}
 
// CommandEnv holds the environment info of commands
var CommandEnv CommandEnvHolder
 
func init() {
    exec, err := os.Executable()
    if err != nil {
        return
    }
    CommandEnv.Exec = path.Base(exec)
}