MCPcopy Index your code
hub / github.com/codeexpress/respounder / initFlags

Function initFlags

respounder.go:229–250  ·  view source on GitHub ↗

parses cmd line flag and set appropriate variables

()

Source from the content-addressed store, hash-verified

227
228// parses cmd line flag and set appropriate variables
229func initFlags() {
230 flag.Usage = func() {
231 fmt.Fprintf(os.Stderr, "Respounder version %1.1f\n", Version)
232 fmt.Fprintf(os.Stderr, "Usage: $ respounder [-json] [-debug] [-interface <iface>] [-hostname <name> | -rhostname]")
233 fmt.Fprintf(os.Stderr, "\n\nFlags:\n")
234 flag.PrintDefaults()
235 }
236
237 flag.Parse()
238 if *jsonPtr {
239 outFile = os.Stderr
240 }
241 if *debugPtr {
242 f, err := os.OpenFile("debug.log",
243 os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
244 if err != nil {
245 panic(err)
246 }
247 logger = log.New(f, "", 0)
248 logger.SetPrefix("[" + time.Now().Format("02-Jan-2006 15:04:05 MST") + "]: ")
249 }
250}

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected