mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-10 17:54:23 +03:00
We'd better keep -h for host
This commit is contained in:
parent
f437d53c1c
commit
5fed5c0718
@ -21,4 +21,4 @@ EXPOSE 53 3000
|
||||
VOLUME /data
|
||||
|
||||
ENTRYPOINT ["/AdGuardHome"]
|
||||
CMD ["-o", "0.0.0.0"]
|
||||
CMD ["-h", "0.0.0.0"]
|
@ -12,4 +12,4 @@ EXPOSE 53 3000
|
||||
VOLUME /data
|
||||
|
||||
ENTRYPOINT ["/AdGuardHome"]
|
||||
CMD ["-o", "0.0.0.0"]
|
||||
CMD ["-h", "0.0.0.0"]
|
@ -127,19 +127,19 @@ You can redefine this behavior in AdGuard Home configuration file (see below).
|
||||
Here is a list of all available command-line arguments.
|
||||
|
||||
```
|
||||
$ ./AdGuardHome -h
|
||||
$ ./AdGuardHome --help
|
||||
Usage:
|
||||
|
||||
./AdGuardHome [options]
|
||||
|
||||
Options:
|
||||
-c, --config path to config file
|
||||
-o, --host host address to bind HTTP server on
|
||||
-h, --host host address to bind HTTP server on
|
||||
-p, --port port to serve HTTP pages on
|
||||
-v, --verbose enable verbose output
|
||||
-s, --service service control action: status, install, uninstall, start, stop, restart
|
||||
-l, --logfile path to the log file. If empty, writes to stdout, if 'syslog' -- system log
|
||||
-h, --help print this help
|
||||
-v, --verbose enable verbose output
|
||||
--help print this help
|
||||
```
|
||||
|
||||
Please note, that the command-line arguments override settings from the configuration file.
|
||||
|
12
app.go
12
app.go
@ -258,7 +258,7 @@ func loadOptions() options {
|
||||
callbackNoValue func()
|
||||
}{
|
||||
{"config", "c", "path to config file", func(value string) { o.configFilename = value }, nil},
|
||||
{"host", "o", "host address to bind HTTP server on", func(value string) { o.bindHost = value }, nil},
|
||||
{"host", "h", "host address to bind HTTP server on", func(value string) { o.bindHost = value }, nil},
|
||||
{"port", "p", "port to serve HTTP pages on", func(value string) {
|
||||
v, err := strconv.Atoi(value)
|
||||
if err != nil {
|
||||
@ -273,7 +273,7 @@ func loadOptions() options {
|
||||
o.logFile = value
|
||||
}, nil},
|
||||
{"verbose", "v", "enable verbose output", nil, func() { o.verbose = true }},
|
||||
{"help", "h", "print this help", nil, func() {
|
||||
{"help", "", "print this help", nil, func() {
|
||||
printHelp()
|
||||
os.Exit(64)
|
||||
}},
|
||||
@ -283,14 +283,18 @@ func loadOptions() options {
|
||||
fmt.Printf("%s [options]\n\n", os.Args[0])
|
||||
fmt.Printf("Options:\n")
|
||||
for _, opt := range opts {
|
||||
fmt.Printf(" -%s, %-30s %s\n", opt.shortName, "--"+opt.longName, opt.description)
|
||||
if opt.shortName != "" {
|
||||
fmt.Printf(" -%s, %-30s %s\n", opt.shortName, "--"+opt.longName, opt.description)
|
||||
} else {
|
||||
fmt.Printf(" %-34s %s\n", "--"+opt.longName, opt.description)
|
||||
}
|
||||
}
|
||||
}
|
||||
for i := 1; i < len(os.Args); i++ {
|
||||
v := os.Args[i]
|
||||
knownParam := false
|
||||
for _, opt := range opts {
|
||||
if v == "--"+opt.longName || v == "-"+opt.shortName {
|
||||
if v == "--"+opt.longName || (opt.shortName != "" && v == "-"+opt.shortName) {
|
||||
if opt.callbackWithValue != nil {
|
||||
if i+1 >= len(os.Args) {
|
||||
log.Printf("ERROR: Got %s without argument\n", v)
|
||||
|
Loading…
Reference in New Issue
Block a user