mirror of
https://github.com/tailscale/tailscale.git
synced 2025-03-29 12:32:24 +00:00
cmd/tailscale: make status --peers=false work earlier + in JSON mode
And return an error if you use non-flag arguments. Change-Id: I0dd6c357eb5cabd0f17020f21ba86406aea21681 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
5df12b9059
commit
06fcf3b225
@ -8,6 +8,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
@ -69,7 +70,14 @@ var statusArgs struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func runStatus(ctx context.Context, args []string) error {
|
func runStatus(ctx context.Context, args []string) error {
|
||||||
st, err := tailscale.Status(ctx)
|
if len(args) > 0 {
|
||||||
|
return errors.New("unexpected non-flag arguments to 'tailscale status'")
|
||||||
|
}
|
||||||
|
getStatus := tailscale.Status
|
||||||
|
if !statusArgs.peers {
|
||||||
|
getStatus = tailscale.StatusWithoutPeers
|
||||||
|
}
|
||||||
|
st, err := getStatus(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fixTailscaledConnectError(err)
|
return fixTailscaledConnectError(err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user