Beispiel #1
0
func init() {
	flag.BoolVarP(&Version, "version", "v", false,
		"Output the current version of the application.")

	flag.StringVarP(&WorkingDir, "working-dir", "w", "./",
		"The directory where all the other directories reside. This "+
			"will be prepended to the rest of the configurable directories.")

	flag.StringVarP(&OutputDir, "output-dir", "o", "public",
		"The directory where the results should be placed.")

	flag.BoolVarP(&EmptyOutputDir, "empty-output-dir", "x", false,
		"Before writing to the output-dir, delete anything inside of it.")

	flag.StringVarP(&TemplateDir, "template-dir", "t", "templates",
		"The directory where the site templates are located.")

	flag.StringVarP(&BlogDir, "blog-dir", "b", "blogs",
		"The directory where the blogs are located.")

	flag.StringVarP(&StaticDir, "static-dir", "s", "static",
		"The directory where the static assets are located.")

	flag.StringVarP(&URL, "url", "u", "",
		"The url to be prepended to link in the RSS feed. Defaults to "+
			"the value in the channel <link>.")

	flag.IntVarP(&MaxIndexEntries, "index-entries", "i", 3,
		"The maximum number of entries to display on the index page.")

}
Beispiel #2
0
func main() {
	flag.Usage = func() {
		fmt.Fprint(os.Stderr, Usage)
	}

	flag.IntVarP(&options.Port, "port", "p", 9080, "")

	flag.Parse()

	// Parse base template
	var err error
	options.template, err = template.New("base").Parse(Template)
	if err != nil {
		log.Fatalln("Error parsing HTML template:", err)
	}
	options.Dir = "apidoc"
	// Verify that the wiki folder exists
	_, err = os.Stat(options.Dir)
	if os.IsNotExist(err) {
		log.Fatalln("Directory not found")
	}

	http.Handle("/apidoc/view", commonHandler(WikiHandler))
	http.Handle("/", commonHandler(WikiHandler))

	log.Println("Listening on:", options.Port)
	http.ListenAndServe(fmt.Sprintf(":%d", options.Port), nil)
}
func (cm *ConfigManager) parseFlags() {
	pflag.StringVarP(&cm.Flags.ConfigFile, "configfile", "c", DefaultConfigFile, "Path to config")
	pflag.StringVarP(&cm.Flags.DestHost, "dest-host", "d", "", "Destination syslog hostname or IP")
	pflag.IntVarP(&cm.Flags.DestPort, "dest-port", "p", 0, "Destination syslog port")
	if utils.CanDaemonize {
		pflag.BoolVarP(&cm.Flags.NoDaemonize, "no-detach", "D", false, "Don't daemonize and detach from the terminal")
	} else {
		cm.Flags.NoDaemonize = true
	}
	pflag.StringVarP(&cm.Flags.Facility, "facility", "f", "user", "Facility")
	pflag.StringVar(&cm.Flags.Hostname, "hostname", "", "Local hostname to send from")
	pflag.StringVar(&cm.Flags.PidFile, "pid-file", "", "Location of the PID file")
	// --parse-syslog
	pflag.StringVarP(&cm.Flags.Severity, "severity", "s", "notice", "Severity")
	// --strip-color
	pflag.BoolVar(&cm.Flags.UseTCP, "tcp", false, "Connect via TCP (no TLS)")
	pflag.BoolVar(&cm.Flags.UseTLS, "tls", false, "Connect via TCP with TLS")
	pflag.BoolVar(&cm.Flags.Poll, "poll", false, "Detect changes by polling instead of inotify")
	pflag.Var(&cm.Flags.RefreshInterval, "new-file-check-interval", "How often to check for new files")
	_ = pflag.Bool("no-eventmachine-tail", false, "No action, provided for backwards compatibility")
	_ = pflag.Bool("eventmachine-tail", false, "No action, provided for backwards compatibility")
	pflag.StringVar(&cm.Flags.DebugLogFile, "debug-log-cfg", "", "the debug log file")
	pflag.StringVar(&cm.Flags.LogLevels, "log", "<root>=INFO", "\"logging configuration <root>=INFO;first=TRACE\"")
	pflag.Parse()
	cm.FlagFiles = pflag.Args()
}
Beispiel #4
0
func init() {
	flag.Usage = printUsage

	// set the defaults
	defaultSSL = true
	defaultPort = 38332
	defaultAddress = "localhost"

	defaultConfigPath := computeDefaultConfigPath()

	flag.StringVarP(&flagConfigPath, "config", "c", defaultConfigPath, "config file path")
	flag.StringVarP(&flagUsername, "rpcuser", "u", "", "rpc user name")
	flag.StringVarP(&flagPassword, "rpcpassword", "p", "", "rpc password")
	flag.BoolVar(&flagSSL, "ssl", defaultSSL, "use secure sockets SSL")
	flag.IntVarP(&flagPort, "port", "n", defaultPort, "port number")
	flag.StringVarP(&flagAddress, "host", "a", defaultAddress, "server address")

	flag.BoolVarP(&verbose, "verbose", "v", false, "verbose output for debugging")
	// k , ignore server certificate errors (not recommended, only for testing self-signed certificates")

	flag.BoolVar(&flagHelp, "help", false, "Display this information")
	flag.BoolVar(&flagVersion, "version", false, "Display version information")
	flag.BoolVarP(&flagInsecure, "insecure", "k", false, "Allow connections to servers with 'insecure' SSL connections e.g. self-signed certificates. By default, this option is false, unless the server is localhost or an explicit IP address, in which case the option is true.")

	flag.Parse()

	flagSetMap = make(map[string]bool)
	flag.Visit(visitFlagSetMap)
}
Beispiel #5
0
func main() {
	flag.Usage = func() {
		fmt.Fprint(os.Stderr, Usage)
	}

	flag.IntVarP(&options.Port, "port", "p", 8080, "")
	flag.StringVar(&options.CustomCSS, "custom-css", "", "")

	flag.Parse()

	options.Dir = flag.Arg(0)

	if options.Dir == "" {
		flag.Usage()
		os.Exit(1)
	}

	log.Println("Serving wiki from", options.Dir)

	// Parse base template
	var err error
	options.template, err = template.New("base").Parse(Template)
	if err != nil {
		log.Fatalln("Error parsing HTML template:", err)
	}

	// Trim trailing slash from root path
	if strings.HasSuffix(options.Dir, "/") {
		options.Dir = options.Dir[:len(options.Dir)-1]
	}

	// Verify that the wiki folder exists
	_, err = os.Stat(options.Dir)
	if os.IsNotExist(err) {
		log.Fatalln("Directory not found")
	}

	// Check if the wiki folder is a Git repository
	options.git = IsGitRepository(options.Dir)
	if options.git {
		log.Println("Git repository found in directory")
	} else {
		log.Println("No git repository found in directory")
	}

	http.Handle("/api/diff/", commonHandler(DiffHandler))
	http.Handle("/", commonHandler(WikiHandler))

	log.Println("Listening on:", options.Port)
	http.ListenAndServe(fmt.Sprintf(":%d", options.Port), nil)
}
Beispiel #6
0
func init() {
	flag.IntVarP(&uidCount, "generation-uids", "u", 1000, "The number of uids in all test files. (generation only)")
}
Beispiel #7
0
func init() {
	flag.IntVarP(&rowCount, "generation-rows", "r", 1000, "The number of rows per test file. (generation only)")
}
Beispiel #8
0
func init() {
	flag.IntVarP(&fileCount, "generation-files", "f", 1000, "The number of test files to create. (generation only)")
}
Beispiel #9
0
func init() {
	flag.IntVarP(&distance, "distance", "d", 5000, "The search space in the geo dimensions (in meters).")
}
Beispiel #10
0
func init() {
	flag.IntVarP(&timeFrame, "timeframe", "m", 3600, "The search space in the time dimension in seconds.")
}