TUN-3809: Allow routes ip show to output as JSON or YAML

It also fixes the marshelling of CIDR into JSON since otherwise
it would show garbled characters as the mask.
This commit is contained in:
Nuno Diegues
2021-01-26 11:58:56 +00:00
parent 2146f71b45
commit 6681d179dc
3 changed files with 33 additions and 10 deletions

View File

@@ -41,7 +41,7 @@ func buildRouteIPSubcommand() *cli.Command {
Usage: "Show the routing table",
UsageText: "cloudflared tunnel [--config FILEPATH] route ip show [flags]",
Description: `Shows your organization's private route table. You can use flags to filter the results.`,
Flags: teamnet.FilterFlags,
Flags: showRoutesFlags(),
},
{
Name: "delete",
@@ -62,6 +62,13 @@ func buildRouteIPSubcommand() *cli.Command {
}
}
func showRoutesFlags() []cli.Flag {
flags := make([]cli.Flag, 0)
flags = append(flags, teamnet.FilterFlags...)
flags = append(flags, outputFormatFlag)
return flags
}
func showRoutesCommand(c *cli.Context) error {
sc, err := newSubcommandContext(c)
if err != nil {