Add Set* functions to allow overriding of localised values after create

This commit is contained in:
Nathan Rijksen 2018-01-22 14:20:47 -05:00
parent 0c34d16c31
commit 5857d322c8

View file

@ -186,6 +186,30 @@ type Command struct {
versionTemplate string 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 // SetArgs sets arguments for the command. It is set to os.Args[1:] by default, if desired, can be overridden
// particularly useful when testing. // particularly useful when testing.
func (c *Command) SetArgs(a []string) { func (c *Command) SetArgs(a []string) {