Follow the leader with help from a server
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

config.go 506B

1234567891011121314151617181920212223242526272829303132
  1. // NGnius 2020-01-30
  2. package main
  3. import (
  4. "flag"
  5. "fmt"
  6. "os"
  7. )
  8. const (
  9. defaultPort = "1337"
  10. defaultRoot = "."
  11. )
  12. var (
  13. printVersionAndExit bool
  14. )
  15. func initArgs() {
  16. flag.StringVar(&port, "port", defaultPort, "Port to listen on")
  17. flag.StringVar(&root, "root", defaultRoot, "Root working directory")
  18. flag.BoolVar(&printVersionAndExit, "version", false, "Print version and exit")
  19. }
  20. func parseArgs() {
  21. flag.Parse()
  22. if printVersionAndExit {
  23. fmt.Println(Name + " v" + Version)
  24. os.Exit(0)
  25. }
  26. }