bb/m/tool/date/date.go
2022-06-17 13:28:39 +05:00

29 lines
409 B
Go

package date
import(
"os"
"flag"
"fmt"
"time"
)
func Run(args []string) {
arg0 := args[0]
args = args[1:]
flagSet := flag.NewFlagSet(arg0, flag.ExitOnError)
flagSet.Usage = func() {
fmt.Fprintf(os.Stderr, "Usage of %s: %s\n", arg0, arg0)
flagSet.PrintDefaults()
}
flagSet.Parse(args)
if len(flagSet.Args())>0 {
flagSet.Usage()
os.Exit(1)
}
date := time.Now()
fmt.Println(date)
}