Skip to content

Commit 2cefdab

Browse files
committed
use commmand name constants in main()
1 parent 8edddf8 commit 2cefdab

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

daemon/listener.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ const (
2323
// The `None` variant here shouldn't really be used.
2424
None DaemonCommand = ""
2525

26+
// Included here for completeness, this command should not have a callback that
27+
// sends a daemon comand as it is intended to be the start of the daemon
28+
// process.
29+
Daemon = "daemon"
30+
2631
// Restarts the HTTP server and rescans directories. Useful when edits have
2732
// been made to the website contents. Should ignore the passed in argument.
2833
Restart = "restart"

main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ func main() {
2020
var logRecord string
2121
var logPrint string
2222

23-
flag.BoolVar(&daemonProc, "daemon", false, "runs the webby server daemon process rather than behaving like a control application")
24-
flag.BoolVar(&reload, "reload", false, "reloads the configuration file and then restarts, this will reset log levels")
25-
flag.BoolVar(&restart, "restart", false, "restarts the webby HTTP server, rescanning directories")
26-
flag.BoolVar(&stop, "stop", false, "stops the running daemon")
27-
flag.StringVar(&logRecord, "log-record", "", "sets the log level to record to file, defaults to 'All'")
28-
flag.StringVar(&logPrint, "log-print", "", "sets the log level to print to standard out, defaults to 'All'")
23+
flag.BoolVar(&daemonProc, daemon.Daemon, false, "runs the webby server daemon process rather than behaving like a control application")
24+
flag.BoolVar(&reload, daemon.Reload, false, "reloads the configuration file and then restarts, this will reset log levels")
25+
flag.BoolVar(&restart, daemon.Restart, false, "restarts the webby HTTP server, rescanning directories")
26+
flag.BoolVar(&stop, daemon.Stop, false, "stops the running daemon")
27+
flag.StringVar(&logRecord, daemon.LogRecord, "", "sets the log level to record to file, defaults to 'All'")
28+
flag.StringVar(&logPrint, daemon.LogPrint, "", "sets the log level to print to standard out, defaults to 'All'")
2929

3030
flag.Parse()
3131

0 commit comments

Comments
 (0)