Merge remote-tracking branch 'upstream/1.0'
This commit is contained in:
commit
1d1ebc103d
3 files changed
+25
-6
No files matched your search
+11
-6
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net"
|
||||
@@ -16,24 +17,24 @@ import (
|
||||
weavenet "github.com/weaveworks/weave/net"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if len(os.Args) <= 1 {
|
||||
os.Exit(0)
|
||||
}
|
||||
var (
|
||||
ErrNoCommandSpecified = errors.New("No command specified")
|
||||
)
|
||||
|
||||
func main() {
|
||||
var (
|
||||
args = os.Args[1:]
|
||||
notInExec = true
|
||||
rewriteHosts = true
|
||||
)
|
||||
|
||||
if args[0] == "-s" {
|
||||
if len(args) > 0 && args[0] == "-s" {
|
||||
notInExec = false
|
||||
rewriteHosts = false
|
||||
args = args[1:]
|
||||
}
|
||||
|
||||
if args[0] == "-h" {
|
||||
if len(args) > 0 && args[0] == "-h" {
|
||||
rewriteHosts = false
|
||||
args = args[1:]
|
||||
}
|
||||
@@ -47,6 +48,10 @@ func main() {
|
||||
iface, err := weavenet.EnsureInterface("ethwe", -1)
|
||||
checkErr(err)
|
||||
|
||||
if len(args) == 0 {
|
||||
checkErr(ErrNoCommandSpecified)
|
||||
}
|
||||
|
||||
if rewriteHosts {
|
||||
updateHosts(iface)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user