版权声明:本文可能为博主原创文章,若标明出处可随便转载。 https://blog.csdn.net/Jailman/article/details/80972643
package main
import (
"flag"
"strings"
"os"
"fmt"
)
var ARGS string
func main() {
var uptime *bool = new(bool)
flag.BoolVar(uptime,"u", false, "print system uptime")
flag.Parse()
ARGS = strings.Join(flag.Args(), " ")
if len(os.Args) < 2 {
flag.Usage()
os.Exit(1)
}
if *uptime {
fmt.Println("12 days")
}
}