env.go 481 B

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