1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
package main
import (
"flag"
"fmt"
)
const help = `Ceres - Recipe server for local networks
Usage: ceres [-h | --help] [-v | --version] [-c | --config]
[-e | --example]
-h, --help show this help page and exit
-v, --version print version information
-c, --config file path to configuration file
-e, --examples inject example recipes on startup
`
var flags struct {
version bool
config string
examples bool
}
func init() {
flag.BoolVar(&flags.version, "version", false, "print version information")
flag.BoolVar(&flags.version, "v", false, "print version information")
flag.StringVar(&flags.config, "config", "", "file path to configuration file")
flag.StringVar(&flags.config, "c", "", "file path to configuration file")
flag.BoolVar(&flags.examples, "examples", false, "inject example recipes on startup")
flag.BoolVar(&flags.examples, "e", false, "inject example recipes on startup")
flag.Usage = func() {
fmt.Fprintf(flag.CommandLine.Output(), help)
}
}
|