mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-10 15:02:37 +02:00
cmd/tailscale/cli: omit "file" subcommand if taildrop is omitted from build
Updates #15812 Updates #12614 Change-Id: Ic945b26a127ba15399abdaab8fe43b1cfa64d874 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
7cc2837594
commit
48dacf1bf7
@ -207,6 +207,8 @@ func noDupFlagify(c *ffcli.Command) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var fileCmd func() *ffcli.Command
|
||||||
|
|
||||||
func newRootCmd() *ffcli.Command {
|
func newRootCmd() *ffcli.Command {
|
||||||
rootfs := newFlagSet("tailscale")
|
rootfs := newFlagSet("tailscale")
|
||||||
rootfs.Func("socket", "path to tailscaled socket", func(s string) error {
|
rootfs.Func("socket", "path to tailscaled socket", func(s string) error {
|
||||||
@ -247,7 +249,7 @@ change in the future.
|
|||||||
serveCmd(),
|
serveCmd(),
|
||||||
versionCmd,
|
versionCmd,
|
||||||
webCmd,
|
webCmd,
|
||||||
fileCmd,
|
nilOrCall(fileCmd),
|
||||||
bugReportCmd,
|
bugReportCmd,
|
||||||
certCmd,
|
certCmd,
|
||||||
netlockCmd,
|
netlockCmd,
|
||||||
@ -286,6 +288,13 @@ func nonNilCmds(cmds ...*ffcli.Command) []*ffcli.Command {
|
|||||||
return slicesx.AppendNonzero(cmds[:0], cmds)
|
return slicesx.AppendNonzero(cmds[:0], cmds)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func nilOrCall(f func() *ffcli.Command) *ffcli.Command {
|
||||||
|
if f == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return f()
|
||||||
|
}
|
||||||
|
|
||||||
func fatalf(format string, a ...any) {
|
func fatalf(format string, a ...any) {
|
||||||
if Fatalf != nil {
|
if Fatalf != nil {
|
||||||
Fatalf(format, a...)
|
Fatalf(format, a...)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) Tailscale Inc & AUTHORS
|
// Copyright (c) Tailscale Inc & AUTHORS
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
//go:build !ts_omit_taildrop
|
||||||
|
|
||||||
package cli
|
package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -38,14 +40,20 @@ import (
|
|||||||
"tailscale.com/version"
|
"tailscale.com/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
var fileCmd = &ffcli.Command{
|
func init() {
|
||||||
Name: "file",
|
fileCmd = getFileCmd
|
||||||
ShortUsage: "tailscale file <cp|get> ...",
|
}
|
||||||
ShortHelp: "Send or receive files",
|
|
||||||
Subcommands: []*ffcli.Command{
|
func getFileCmd() *ffcli.Command {
|
||||||
fileCpCmd,
|
return &ffcli.Command{
|
||||||
fileGetCmd,
|
Name: "file",
|
||||||
},
|
ShortUsage: "tailscale file <cp|get> ...",
|
||||||
|
ShortHelp: "Send or receive files",
|
||||||
|
Subcommands: []*ffcli.Command{
|
||||||
|
fileCpCmd,
|
||||||
|
fileGetCmd,
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type countingReader struct {
|
type countingReader struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user