bb/tool/whoami/main.go
2023-10-23 15:00:45 +03:00

25 lines
291 B
Go

package whoami
import(
"os"
"os/user"
"fmt"
"log"
"github.com/reklesio/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)
}