From bf596c035e43c11c1e9f7e31a24af0dcca333d51 Mon Sep 17 00:00:00 2001 From: Nick Vollmar Date: Mon, 17 Dec 2018 11:18:34 -0600 Subject: [PATCH] TUN-1140: Show usage if invoked with no args or config --- cmd/cloudflared/main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/cloudflared/main.go b/cmd/cloudflared/main.go index b7bd2442..a5bea5fb 100644 --- a/cmd/cloudflared/main.go +++ b/cmd/cloudflared/main.go @@ -83,8 +83,15 @@ func flags() []cli.Flag { return append(flags, access.Flags()...) } +func isEmptyInvocation(c *cli.Context) bool { + return c.NArg() == 0 && c.NumFlags() == 0 +} + func action(version string, shutdownC, graceShutdownC chan struct{}) cli.ActionFunc { return func(c *cli.Context) (err error) { + if isEmptyInvocation(c) { + cli.ShowAppHelpAndExit(c, 1) + } tags := make(map[string]string) tags["hostname"] = c.String("hostname") raven.SetTagsContext(tags)