bb/tool/whoami/main.go
2023-12-14 21:42:01 +03:00

25 lines
291 B
Go

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