cmd/tailscale: make status --peers=false work earlier + in JSON mode
And return an error if you use non-flag arguments.
"bytes"
"context"
"encoding/json"
+ "errors"
"flag"
"fmt"
"net"
}
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 {
return fixTailscaledConnectError(err)
}
