Added CLI commands
This commit is contained in:
parent
ccb76696c3
commit
4f2bb677dc
10 changed files with 143 additions and 2 deletions
41
cli/System.go
Normal file
41
cli/System.go
Normal file
|
@ -0,0 +1,41 @@
|
|||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue