bb/tool/whoami/main.go
2024-05-15 23:07:35 +05:00

25 lines
291 B
Go

package whoami
import(
"os"
"os/user"
"fmt"
"log"
"surdeus.su/core/cli/mtool"
)
func Run(flagSet *mtool.Flags) {
flagSet.Parse()
if len(flagSet.Args())>0 {
flagSet.Usage()
os.Exit(1)
}
u, err := user.Current()
if err != nil {
log.Fatal(err)
}
fmt.Print(u.Username)
}