mirror of
https://github.com/spf13/cobra
synced 2025-05-05 21:07:24 +00:00
Add Set* functions to allow overriding of localised values after create
This commit is contained in:
parent
0c34d16c31
commit
5857d322c8
1 changed files with 24 additions and 0 deletions
24
command.go
24
command.go
|
@ -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) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue