TUN-1140: Show usage if invoked with no args or config

This commit is contained in:
Nick Vollmar 2018-12-17 11:18:34 -06:00
parent 36276e957a
commit bf596c035e
1 changed files with 7 additions and 0 deletions

View File

@ -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)