Skip to content

Commit

Permalink
cmd/tailscale/cli: prepend "tailscale" to usage errors
Browse files Browse the repository at this point in the history
Updates tailscale#11626

Signed-off-by: Paul Scott <paul@tailscale.com>
  • Loading branch information
icio committed Apr 17, 2024
1 parent d07ede4 commit 454a03a
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions cmd/tailscale/cli/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ var debugComponentLogsArgs struct {

func runDebugComponentLogs(ctx context.Context, args []string) error {
if len(args) != 1 {
return errors.New("usage: debug component-logs [" + strings.Join(ipn.DebuggableComponents, "|") + "]")
return errors.New("usage: tailscale debug component-logs [" + strings.Join(ipn.DebuggableComponents, "|") + "]")
}
component := args[0]
dur := debugComponentLogsArgs.forDur
Expand All @@ -865,7 +865,7 @@ var devStoreSetArgs struct {

func runDevStoreSet(ctx context.Context, args []string) error {
if len(args) != 2 {
return errors.New("usage: dev-store-set --danger <key> <value>")
return errors.New("usage: tailscale debug dev-store-set --danger <key> <value>")
}
if !devStoreSetArgs.danger {
return errors.New("this command is dangerous; use --danger to proceed")
Expand All @@ -883,7 +883,7 @@ func runDevStoreSet(ctx context.Context, args []string) error {

func runDebugDERP(ctx context.Context, args []string) error {
if len(args) != 1 {
return errors.New("usage: debug derp <region>")
return errors.New("usage: tailscale debug derp <region>")
}
st, err := localClient.DebugDERPRegion(ctx, args[0])
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/tailscale/cli/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ func runFileGetOneBatch(ctx context.Context, dir string) []error {

func runFileGet(ctx context.Context, args []string) error {
if len(args) != 1 {
return errors.New("usage: file get <target-directory>")
return errors.New("usage: tailscale file get <target-directory>")
}
log.SetFlags(0)

Expand Down
2 changes: 1 addition & 1 deletion cmd/tailscale/cli/id-token.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var idTokenCmd = &ffcli.Command{

func runIDToken(ctx context.Context, args []string) error {
if len(args) != 1 {
return errors.New("usage: id-token <aud>")
return errors.New("usage: tailscale id-token <aud>")
}

tr, err := localClient.IDToken(ctx, args[0])
Expand Down
2 changes: 1 addition & 1 deletion cmd/tailscale/cli/nc.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func runNC(ctx context.Context, args []string) error {
}

if len(args) != 2 {
return errors.New("usage: nc <hostname-or-IP> <port>")
return errors.New("usage: tailscale nc <hostname-or-IP> <port>")
}

hostOrIP, portStr := args[0], args[1]
Expand Down
6 changes: 3 additions & 3 deletions cmd/tailscale/cli/network-lock.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ func runNetworkLockSign(ctx context.Context, args []string) error {
)

if len(args) == 0 || len(args) > 2 {
return errors.New("usage: lock sign <node-key> [<rotation-key>]")
return errors.New("usage: tailscale lock sign <node-key> [<rotation-key>]")
}
if err := nodeKey.UnmarshalText([]byte(args[0])); err != nil {
return fmt.Errorf("decoding node-key: %w", err)
Expand Down Expand Up @@ -508,7 +508,7 @@ func runNetworkLockDisable(ctx context.Context, args []string) error {
return err
}
if len(secrets) != 1 {
return errors.New("usage: lock disable <disablement-secret>")
return errors.New("usage: tailscale lock disable <disablement-secret>")
}
return localClient.NetworkLockDisable(ctx, secrets[0])
}
Expand Down Expand Up @@ -545,7 +545,7 @@ var nlDisablementKDFCmd = &ffcli.Command{

func runNetworkLockDisablementKDF(ctx context.Context, args []string) error {
if len(args) != 1 {
return errors.New("usage: lock disablement-kdf <hex-encoded-disablement-secret>")
return errors.New("usage: tailscale lock disablement-kdf <hex-encoded-disablement-secret>")
}
secret, err := hex.DecodeString(args[0])
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/tailscale/cli/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func runPing(ctx context.Context, args []string) error {
}

if len(args) != 1 || args[0] == "" {
return errors.New("usage: ping <hostname-or-IP>")
return errors.New("usage: tailscale ping <hostname-or-IP>")
}
var ip string

Expand Down
2 changes: 1 addition & 1 deletion cmd/tailscale/cli/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func runSSH(ctx context.Context, args []string) error {
return errors.New("The 'tailscale ssh' subcommand is not available on macOS builds distributed through the App Store or TestFlight.\nInstall the Standalone variant of Tailscale (download it from https://pkgs.tailscale.com), or use the regular 'ssh' client instead.")
}
if len(args) == 0 {
return errors.New("usage: ssh [user@]<host>")
return errors.New("usage: tailscale ssh [user@]<host>")
}
arg, argRest := args[0], args[1:]
username, host, ok := strings.Cut(arg, "@")
Expand Down

0 comments on commit 454a03a

Please sign in to comment.