2023-02-26 13:12:40 +03:00
|
|
|
package whoami
|
|
|
|
|
|
|
|
import(
|
|
|
|
"os"
|
|
|
|
"os/user"
|
|
|
|
"fmt"
|
|
|
|
"log"
|
2023-12-14 21:42:01 +03:00
|
|
|
"github.com/di4f/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)
|
|
|
|
}
|