cmd/tailscale: print a helpful error for Taildrive CLI on macOS GUI
Rather than printing `unknown subcommand: drive` for any Taildrive commands run in the macOS GUI, print an error message directing the user to the GUI client and the docs page. Updates #17210 Fixes #18823 Change-Id: I6435007b5911baee79274b56e3ee101e6bb6d809 Signed-off-by: Alex Chan <alexc@tailscale.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
// Copyright (c) Tailscale Inc & contributors
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build !ts_omit_drive && ts_mac_gui
|
||||
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"github.com/peterbourgon/ff/v3/ffcli"
|
||||
)
|
||||
|
||||
func init() {
|
||||
maybeDriveCmd = driveCmdStub
|
||||
}
|
||||
|
||||
func driveCmdStub() *ffcli.Command {
|
||||
return &ffcli.Command{
|
||||
Name: "drive",
|
||||
ShortHelp: "Share a directory with your tailnet",
|
||||
ShortUsage: "tailscale drive [...any]",
|
||||
LongHelp: hidden + "Taildrive allows you to share directories with other machines on your tailnet.",
|
||||
Exec: func(_ context.Context, args []string) error {
|
||||
return errors.New(
|
||||
"Taildrive CLI commands are not supported when using the macOS GUI app. " +
|
||||
"Please use the Tailscale menu bar icon to configure Taildrive in Settings.\n\n" +
|
||||
"See https://tailscale.com/docs/features/taildrive",
|
||||
)
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user