Skip to content

Commit

Permalink
cmd/systemd-networkd-dns: add help text (#9)
Browse files Browse the repository at this point in the history
I ran `<program> --help` and it was interpreted as an interface, not
as an instruction to print the help text, so it might be good to fix
that.
  • Loading branch information
kevinburke authored and FiloSottile committed Nov 8, 2018
1 parent a8f2572 commit 0f84599
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions cmd/systemd-networkd-dns/main.go
Expand Up @@ -6,6 +6,7 @@
package main

import (
"flag"
"fmt"
"log"
"net"
Expand All @@ -18,9 +19,22 @@ import (

func main() {
args := os.Args
flag.Usage = func() {
fmt.Printf(`usage: %s <interface>
The systemd-networkd-dns command obtains the DHCP DNS server via DBus.
For this to work, you must be running both systemd-networkd and
systemd-resolved and provide the network interface name for your NIC
that's connected to the DHCP network.
`, args[0])
flag.PrintDefaults()
}
flag.Parse()
if len(args) < 2 {
log.Println("usage:", args[0], "<interface>")
log.Fatalln("error: must provide interface name for DHCP-enabled NIC")
log.Println("error: must provide interface name for DHCP-enabled NIC")
flag.Usage()
os.Exit(2)
}

dns, err := getDHCPDNSForInterfaceFromDBus(args[1])
Expand Down

0 comments on commit 0f84599

Please sign in to comment.