From 5857d322c82ad7e9921b623d683d541acf70922c Mon Sep 17 00:00:00 2001 From: Nathan Rijksen Date: Mon, 22 Jan 2018 14:20:47 -0500 Subject: [PATCH] Add Set* functions to allow overriding of localised values after create --- command.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/command.go b/command.go index 5fefb58d..eb938bcf 100644 --- a/command.go +++ b/command.go @@ -186,6 +186,30 @@ type Command struct { versionTemplate string } +// SetUse allows you to set the Use property after the command has been created, primarily intended to +// facilitate localisation +func (c *Command) SetUse(s string) { + c.Use = s +} + +// SetShort allows you to set the Short property after the command has been created, primarily intended to +// facilitate localisation +func (c *Command) SetShort(s string) { + c.Short = s +} + +// SetLong allows you to set the Long property after the command has been created, primarily intended to +// facilitate localisation +func (c *Command) SetLong(s string) { + c.Long = s +} + +// SetExample allows you to set the Example property after the command has been created, primarily intended to +// facilitate localisation +func (c *Command) SetExample(s string) { + c.Example = s +} + // SetArgs sets arguments for the command. It is set to os.Args[1:] by default, if desired, can be overridden // particularly useful when testing. func (c *Command) SetArgs(a []string) {