Exemplo n.º 1
0
func flagParse() {
	flDaemon := flag.Bool([]string{"D", "-daemon"}, false, "Enable daemon mode")
	flVersion := flag.Bool([]string{"V", "-version"}, false, "Show version")
	flToken := flag.String([]string{"-token"}, "", "user token")

	flag.Usage = cmd.ShowUsage
	//flag.PrintDefaults()
	flag.Parse()
	//fmt.Printf("run daemon: %v, version: %v\n", *flDaemon, *flVersion)

	if *flVersion {
		fmt.Println("datahub", ds.DATAHUB_VERSION)
		os.Exit(0)
	}

	if len(*flToken) == 40 {
		daemonigo.Token = *flToken
		daemon.DaemonID = *flToken
	}

	if *flDaemon {
		runDaemon = true

	}
}
Exemplo n.º 2
0
func flagParse() {
	flDaemon := flag.Bool([]string{"D", "-daemon"}, false, "Enable daemon mode")
	flVersion := flag.Bool([]string{"V", "-version"}, false, "Show version")

	flag.Usage = client.ShowUsage
	//flag.PrintDefaults()
	flag.Parse()
	//fmt.Printf("run daemon: %v, version: %v\n", *flDaemon, *flVersion)

	if *flVersion {
		fmt.Println("datahub v0.1.0")
		os.Exit(0)
	}

	if *flDaemon {
		runDaemon = true
	}
}