feature/drive: start factoring out Taildrive, add ts_omit_drive build tag
As of this commit (per the issue), the Taildrive code remains where it was, but in new files that are protected by the new ts_omit_drive build tag. Future commits will move it. Updates #17058 Change-Id: Idf0a51db59e41ae8da6ea2b11d238aefc48b219e Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
82c5024f03
commit
a1dcf12b67
@@ -210,6 +210,7 @@ func noDupFlagify(c *ffcli.Command) {
|
||||
var fileCmd func() *ffcli.Command
|
||||
var sysPolicyCmd func() *ffcli.Command
|
||||
var maybeWebCmd func() *ffcli.Command
|
||||
var maybeDriveCmd func() *ffcli.Command
|
||||
|
||||
func newRootCmd() *ffcli.Command {
|
||||
rootfs := newFlagSet("tailscale")
|
||||
@@ -262,7 +263,7 @@ change in the future.
|
||||
updateCmd,
|
||||
whoisCmd,
|
||||
debugCmd(),
|
||||
driveCmd,
|
||||
nilOrCall(maybeDriveCmd),
|
||||
idTokenCmd,
|
||||
configureHostCmd(),
|
||||
systrayCmd,
|
||||
|
||||
+44
-36
@@ -1,6 +1,8 @@
|
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build !ts_omit_drive
|
||||
|
||||
package cli
|
||||
|
||||
import (
|
||||
@@ -20,43 +22,49 @@ const (
|
||||
driveListUsage = "tailscale drive list"
|
||||
)
|
||||
|
||||
var driveCmd = &ffcli.Command{
|
||||
Name: "drive",
|
||||
ShortHelp: "Share a directory with your tailnet",
|
||||
ShortUsage: strings.Join([]string{
|
||||
driveShareUsage,
|
||||
driveRenameUsage,
|
||||
driveUnshareUsage,
|
||||
driveListUsage,
|
||||
}, "\n"),
|
||||
LongHelp: buildShareLongHelp(),
|
||||
UsageFunc: usageFuncNoDefaultValues,
|
||||
Subcommands: []*ffcli.Command{
|
||||
{
|
||||
Name: "share",
|
||||
ShortUsage: driveShareUsage,
|
||||
Exec: runDriveShare,
|
||||
ShortHelp: "[ALPHA] Create or modify a share",
|
||||
func init() {
|
||||
maybeDriveCmd = driveCmd
|
||||
}
|
||||
|
||||
func driveCmd() *ffcli.Command {
|
||||
return &ffcli.Command{
|
||||
Name: "drive",
|
||||
ShortHelp: "Share a directory with your tailnet",
|
||||
ShortUsage: strings.Join([]string{
|
||||
driveShareUsage,
|
||||
driveRenameUsage,
|
||||
driveUnshareUsage,
|
||||
driveListUsage,
|
||||
}, "\n"),
|
||||
LongHelp: buildShareLongHelp(),
|
||||
UsageFunc: usageFuncNoDefaultValues,
|
||||
Subcommands: []*ffcli.Command{
|
||||
{
|
||||
Name: "share",
|
||||
ShortUsage: driveShareUsage,
|
||||
Exec: runDriveShare,
|
||||
ShortHelp: "[ALPHA] Create or modify a share",
|
||||
},
|
||||
{
|
||||
Name: "rename",
|
||||
ShortUsage: driveRenameUsage,
|
||||
ShortHelp: "[ALPHA] Rename a share",
|
||||
Exec: runDriveRename,
|
||||
},
|
||||
{
|
||||
Name: "unshare",
|
||||
ShortUsage: driveUnshareUsage,
|
||||
ShortHelp: "[ALPHA] Remove a share",
|
||||
Exec: runDriveUnshare,
|
||||
},
|
||||
{
|
||||
Name: "list",
|
||||
ShortUsage: driveListUsage,
|
||||
ShortHelp: "[ALPHA] List current shares",
|
||||
Exec: runDriveList,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "rename",
|
||||
ShortUsage: driveRenameUsage,
|
||||
ShortHelp: "[ALPHA] Rename a share",
|
||||
Exec: runDriveRename,
|
||||
},
|
||||
{
|
||||
Name: "unshare",
|
||||
ShortUsage: driveUnshareUsage,
|
||||
ShortHelp: "[ALPHA] Remove a share",
|
||||
Exec: runDriveUnshare,
|
||||
},
|
||||
{
|
||||
Name: "list",
|
||||
ShortUsage: driveListUsage,
|
||||
ShortHelp: "[ALPHA] List current shares",
|
||||
Exec: runDriveList,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// runDriveShare is the entry point for the "tailscale drive share" command.
|
||||
|
||||
Reference in New Issue
Block a user