bb/tool/whoami/main.go

26 lines
291 B
Go
Raw Normal View History

2023-02-26 13:12:40 +03:00
package whoami
import(
"os"
"os/user"
"fmt"
"log"
2024-01-05 03:22:55 +03:00
"vultras.su/core/cli/mtool"
2023-02-26 13:12:40 +03:00
)
2023-03-24 19:47:31 +03:00
func Run(flagSet *mtool.Flags) {
flagSet.Parse()
2023-02-26 13:12:40 +03:00
if len(flagSet.Args())>0 {
flagSet.Usage()
os.Exit(1)
}
u, err := user.Current()
if err != nil {
log.Fatal(err)
}
fmt.Print(u.Username)
}