cmd/tailscale/cli: fix "subcommand required" errors when typod

Fixes #11672

Signed-off-by: Paul Scott <paul@tailscale.com>
This commit is contained in:
Paul Scott
2024-04-16 15:18:57 +01:00
committed by Paul Scott
parent 3ff3445e9d
commit d07ede461a
8 changed files with 67 additions and 27 deletions
+8 -1
View File
@@ -26,7 +26,7 @@ import (
var netlockCmd = &ffcli.Command{
Name: "lock",
ShortUsage: "tailscale lock <sub-command> <arguments>",
ShortUsage: "tailscale lock <subcommand> [arguments...]",
ShortHelp: "Manage tailnet lock",
LongHelp: "Manage tailnet lock",
Subcommands: []*ffcli.Command{
@@ -49,6 +49,9 @@ func runNetworkLockNoSubcommand(ctx context.Context, args []string) error {
if len(args) >= 2 && args[0] == "tskey-wrap" {
return runTskeyWrapCmd(ctx, args[1:])
}
if len(args) > 0 {
return fmt.Errorf("tailscale lock: unknown subcommand: %s", args[0])
}
return runNetworkLockStatus(ctx, args)
}
@@ -195,6 +198,10 @@ var nlStatusCmd = &ffcli.Command{
}
func runNetworkLockStatus(ctx context.Context, args []string) error {
if len(args) > 0 {
return fmt.Errorf("tailscale lock status: unexpected argument")
}
st, err := localClient.NetworkLockStatus(ctx)
if err != nil {
return fixTailscaledConnectError(err)