This is an education project that attempts to reimplement the GNU coreutils in Go. You can find the full manual here:
https://www.gnu.org/software/coreutils/manual/coreutils.html
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
379 B
29 lines
379 B
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
"flag"
|
|
)
|
|
|
|
func main() {
|
|
var result string
|
|
var universal bool
|
|
|
|
it_is := time.Now()
|
|
|
|
flag.BoolVar(&universal, "u", false, "UTC time.")
|
|
flag.Parse()
|
|
|
|
if universal {
|
|
it_is = it_is.UTC()
|
|
}
|
|
|
|
if flag.NArg() == 1 {
|
|
result = it_is.Format(flag.Args()[0])
|
|
} else {
|
|
result = it_is.String()
|
|
}
|
|
|
|
fmt.Println(result)
|
|
}
|
|
|