q/cli/System.go
2023-10-17 14:01:01 +02:00

42 lines
689 B
Go

package cli
import (
"os"
"runtime"
"git.akyoto.dev/cli/q/log"
)
func System(args []string) int {
line := "%-19s%s\n"
// Platform
log.Info.Printf(line, "Platform:", runtime.GOOS)
// Architecture
log.Info.Printf(line, "Architecture:", runtime.GOARCH)
// Go
log.Info.Printf(line, "Go:", runtime.Version())
// Directory
directory, err := os.Getwd()
if err == nil {
log.Info.Printf(line, "Directory:", directory)
} else {
log.Info.Printf(line, "Directory:", err.Error())
}
// Compiler
executable, err := os.Executable()
if err == nil {
log.Info.Printf(line, "Compiler:", executable)
} else {
log.Info.Printf(line, "Compiler:", err.Error())
}
return 0
}