From 874a7180eafa9cdca0a8acdd15ce2e29b7297a4d Mon Sep 17 00:00:00 2001 From: Christian Frichot Date: Tue, 22 Sep 2020 19:50:04 +0800 Subject: [PATCH] Fix segfault with boundary sessions help output (#403) --- internal/cmd/commands/sessions/session.go | 30 ++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/internal/cmd/commands/sessions/session.go b/internal/cmd/commands/sessions/session.go index 41e7eb6616..a4a352bcd6 100644 --- a/internal/cmd/commands/sessions/session.go +++ b/internal/cmd/commands/sessions/session.go @@ -36,10 +36,34 @@ var flagsMap = map[string][]string{ func (c *Command) Help() string { helpMap := common.HelpMap("session") - if c.Func == "" { - return helpMap["base"]() + var helpStr string + switch c.Func { + case "": + return base.WrapForHelpText([]string{ + "Usage: boundary sessions [sub command] [options] [args]", + "", + " This command allows operations on Boundary sessions.", + "", + " Read a session:", + "", + ` $ boundary sessions read -id s_1234567890`, + "", + " Please see the sessions subcommand help for detailed usage information.", + }) + case "cancel": + helpStr = base.WrapForHelpText([]string{ + "Usage: boundary sessions cancel [options] [args]", + "", + " Cancel the session specified by ID. Example:", + "", + ` $ boundary sessions cancel -id s_1234567890`, + "", + "", + }) + default: + helpStr = helpMap[c.Func]() } - return helpMap[c.Func]() + c.Flags().Help() + return helpStr + c.Flags().Help() } func (c *Command) Flags() *base.FlagSets {