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:
committed by
Brad Fitzpatrick
parent
7cc2837594
commit
48dacf1bf7
@@ -207,6 +207,8 @@ func noDupFlagify(c *ffcli.Command) {
|
||||
}
|
||||
}
|
||||
|
||||
var fileCmd func() *ffcli.Command
|
||||
|
||||
func newRootCmd() *ffcli.Command {
|
||||
rootfs := newFlagSet("tailscale")
|
||||
rootfs.Func("socket", "path to tailscaled socket", func(s string) error {
|
||||
@@ -247,7 +249,7 @@ change in the future.
|
||||
serveCmd(),
|
||||
versionCmd,
|
||||
webCmd,
|
||||
fileCmd,
|
||||
nilOrCall(fileCmd),
|
||||
bugReportCmd,
|
||||
certCmd,
|
||||
netlockCmd,
|
||||
@@ -286,6 +288,13 @@ func nonNilCmds(cmds ...*ffcli.Command) []*ffcli.Command {
|
||||
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) {
|
||||
if Fatalf != nil {
|
||||
Fatalf(format, a...)
|
||||
|
||||
Reference in New Issue
Block a user