cmd/tailscale/cli: use errors.Is to check ff's wrapped flag errors

And also check from its Parse method.

Change-Id: I18754920575254cb6858a16b7954e74aa16483a1
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick 2021-10-27 14:06:22 -07:00
parent 75de4e9cc2
commit 3b5ada1fd8

View File

@ -139,13 +139,16 @@ func Run(args []string) error {
}
if err := rootCmd.Parse(args); err != nil {
if errors.Is(err, flag.ErrHelp) {
return nil
}
return err
}
tailscale.TailscaledSocket = rootArgs.socket
err := rootCmd.Run(context.Background())
if err == flag.ErrHelp {
if errors.Is(err, flag.ErrHelp) {
return nil
}
return err