github.com/xmplusdev/xmcore@v1.8.11-0.20240412132628-5518b55526af/main/commands/base/env.go (about)

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