Skip to content

Commit c52e0dc

Browse files
committed
TUN-3395: Unhide named tunnel subcommands, tweak help
1 parent 5534644 commit c52e0dc

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

cmd/cloudflared/tunnel/subcommands.go

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,12 @@ var (
8080
}
8181
)
8282

83-
const hideSubcommands = true
84-
8583
func buildCreateCommand() *cli.Command {
8684
return &cli.Command{
8785
Name: "create",
8886
Action: cliutil.ErrorHandler(createCommand),
8987
Usage: "Create a new tunnel with given name",
9088
ArgsUsage: "TUNNEL-NAME",
91-
Hidden: hideSubcommands,
9289
Flags: []cli.Flag{outputFormatFlag},
9390
}
9491
}
@@ -153,7 +150,6 @@ func buildListCommand() *cli.Command {
153150
Action: cliutil.ErrorHandler(listCommand),
154151
Usage: "List existing tunnels",
155152
ArgsUsage: " ",
156-
Hidden: hideSubcommands,
157153
Flags: []cli.Flag{outputFormatFlag, showDeletedFlag, listNameFlag, listExistedAtFlag, listIDFlag, showRecentlyDisconnected},
158154
}
159155
}
@@ -209,6 +205,7 @@ func fmtAndPrintTunnelList(tunnels []*tunnelstore.Tunnel, showRecentlyDisconnect
209205
)
210206

211207
writer := tabwriter.NewWriter(os.Stdout, minWidth, tabWidth, padding, padChar, flags)
208+
defer writer.Flush()
212209

213210
// Print column headers with tabbed columns
214211
fmt.Fprintln(writer, "ID\tNAME\tCREATED\tCONNECTIONS\t")
@@ -224,9 +221,6 @@ func fmtAndPrintTunnelList(tunnels []*tunnelstore.Tunnel, showRecentlyDisconnect
224221
)
225222
fmt.Fprintln(writer, formattedStr)
226223
}
227-
228-
// Write data buffered in tabwriter to output
229-
writer.Flush()
230224
}
231225

232226
func fmtConnections(connections []tunnelstore.Connection, showRecentlyDisconnected bool) string {
@@ -258,9 +252,8 @@ func buildDeleteCommand() *cli.Command {
258252
return &cli.Command{
259253
Name: "delete",
260254
Action: cliutil.ErrorHandler(deleteCommand),
261-
Usage: "Delete existing tunnel with given IDs",
262-
ArgsUsage: "TUNNEL-ID",
263-
Hidden: hideSubcommands,
255+
Usage: "Delete existing tunnel by UUID or name",
256+
ArgsUsage: "TUNNEL",
264257
Flags: []cli.Flag{credentialsFileFlag, forceDeleteFlag},
265258
}
266259
}
@@ -301,12 +294,13 @@ func buildRunCommand() *cli.Command {
301294
Name: "run",
302295
Action: cliutil.ErrorHandler(runCommand),
303296
Usage: "Proxy a local web server by running the given tunnel",
304-
ArgsUsage: "TUNNEL-ID",
305-
Description: "Runs the tunnel, creating a high-availability connection between your server and the Cloudflare " +
306-
"edge. This command requires the tunnel credentials file created when `cloudflared tunnel create` was run, but " +
307-
"does not require the cert.pem from `cloudflared login`. If you experience problems running the tunnel, " +
308-
"`cloudflared tunnel cleanup` may help by removing any old connection records.",
309-
Hidden: hideSubcommands,
297+
ArgsUsage: "TUNNEL",
298+
Description: `Runs the tunnel identified by name or UUUD, creating a highly available connection
299+
between your server and the Cloudflare edge.
300+
301+
This command requires the tunnel credentials file created when "cloudflared tunnel create" was run,
302+
however it does not need access to cert.pem from "cloudflared login". If you experience problems running
303+
the tunnel, "cloudflared tunnel cleanup" may help by removing any old connection records.`,
310304
Flags: []cli.Flag{forceFlag, credentialsFileFlag},
311305
}
312306
}
@@ -332,9 +326,8 @@ func buildCleanupCommand() *cli.Command {
332326
return &cli.Command{
333327
Name: "cleanup",
334328
Action: cliutil.ErrorHandler(cleanupCommand),
335-
Usage: "Cleanup connections for the tunnel with given IDs",
336-
ArgsUsage: "TUNNEL-IDS",
337-
Hidden: hideSubcommands,
329+
Usage: "Cleanup tunnel connections",
330+
ArgsUsage: "TUNNEL",
338331
}
339332
}
340333

@@ -362,11 +355,10 @@ func buildRouteCommand() *cli.Command {
362355
Action: cliutil.ErrorHandler(routeCommand),
363356
Usage: "Define what hostname or load balancer can route to this tunnel",
364357
Description: `The route defines what hostname or load balancer can route to this tunnel.
365-
To route a hostname: cloudflared tunnel route dns <tunnel ID> <hostname>
366-
To route a load balancer: cloudflared tunnel route lb <tunnel ID> <load balancer name> <load balancer pool>
367-
If you don't specify a load balancer pool, we will create a new pool called tunnel:<tunnel ID>`,
368-
ArgsUsage: "dns|lb TUNNEL-ID HOSTNAME [LB-POOL]",
369-
Hidden: hideSubcommands,
358+
359+
To route a hostname: cloudflared tunnel route dns <tunnel ID> <hostname>
360+
To use this tunnel as a load balancer origin: cloudflared tunnel route lb <tunnel ID> <load balancer name> <load balancer pool>`,
361+
ArgsUsage: "dns|lb TUNNEL HOSTNAME [LB-POOL]",
370362
}
371363
}
372364

0 commit comments

Comments
 (0)