Merge branch 'issues-54' into 'master'

Issue 54: Fix CLI output while listing routes

Closes #54

See merge request !93
This commit is contained in:
Denis Makogon
2017-07-06 13:38:49 -07:00

View File

@@ -168,16 +168,15 @@ func (a *routesCmd) list(c *cli.Context) error {
return fmt.Errorf("unexpected error: %s", err)
}
w := tabwriter.NewWriter(os.Stdout, 0, 8, 0, '\t', 0)
w := tabwriter.NewWriter(os.Stdout, 0, 8, 1, '\t', 0)
fmt.Fprint(w, "path", "\t", "image", "\t", "endpoint", "\n")
for _, route := range resp.Payload.Routes {
u, err := url.Parse("../")
u.Path = path.Join(u.Path, "r", appName, route.Path)
endpoint := path.Join(client.Host(), "r", appName, route.Path)
if err != nil {
return fmt.Errorf("error parsing functions route path: %s", err)
}
fmt.Fprint(w, route.Path, "\t", route.Image, "\n")
fmt.Fprint(w, route.Path, "\t", route.Image, "\t", endpoint, "\n")
}
w.Flush()