forked from tcnksm/gcli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
command.go
40 lines (31 loc) · 922 Bytes
/
command.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package skeleton
const (
// DefaultSynopsis is default synopsis message.
DefaultSynopsis = ""
// DefaultHelp is default help message.
DefaultHelp = ""
)
// Command store command meta information.
type Command struct {
// Name is command name.
Name string
// FunctionName is name used for function decralation.
// in generating souce code. Name may contain invalid charactor
// like `-` so it holds valid name for it.
FunctionName string
// Flags are flag for the command.
Flags []Flag
// Synopsis is short help message of the command.
Synopsis string
// Help is long help message of the command.
Help string
// debugOutput is injected to command function
// and generate for debugging purpose.
// TODO: https://github.com/BurntSushi/toml/pull/90
DebugOutput string `toml:",omitempty"`
}
// Fix fixes user input
func (c *Command) Fix() error {
c.FunctionName = camelCase(c.Name)
return nil
}