-
Notifications
You must be signed in to change notification settings - Fork 0
/
argumenttypes.go
117 lines (95 loc) · 2.59 KB
/
argumenttypes.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package arguduck
// arguDuckArgumentInterface is an interface that all argument types must implement.
// It provides methods to retrieve argument properties.
type arguDuckArgumentInterface interface {
getName() string
getShort() string
getGroup() string
getHelp() string
}
// arguDuckArgument is a base struct for command-line arguments, providing common properties.
type arguDuckArgument struct {
name string
short string
help string
group string
}
// stringArgument represents a command-line argument with a string value.
type stringArgument struct {
arguDuckArgument
defaultValue string
}
// getName returns the full name of the string argument.
func (s *stringArgument) getName() string {
return s.name
}
// getShort returns the abbreviated name of the string argument.
func (s *stringArgument) getShort() string {
return s.short
}
// getGroup returns the group name of the string argument.
func (s *stringArgument) getGroup() string {
return s.group
}
func (s *stringArgument) getHelp() string {
return s.help
}
type intArgument struct {
arguDuckArgument
defaultValue int
}
// getName returns the full name of the int argument.
func (i *intArgument) getName() string {
return i.name
}
// getShort returns the abbreviated name of the int argument.
func (i *intArgument) getShort() string {
return i.short
}
// getGroup returns the group name of the int argument.
func (i *intArgument) getGroup() string {
return i.group
}
// getHelp returns the help text of the int argument.
func (i *intArgument) getHelp() string {
return i.help
}
type flagArgument struct {
arguDuckArgument
}
// getName returns the full name of the flag argument.
func (f *flagArgument) getName() string {
return f.name
}
// getShort returns the abbreviated name of the flag argument.
func (f *flagArgument) getShort() string {
return f.short
}
// getGroup returns the group name of the flag argument.
func (f *flagArgument) getGroup() string {
return f.group
}
// getHelp returns the help text of the flag argument.
func (f *flagArgument) getHelp() string {
return f.help
}
type floatArgument struct {
arguDuckArgument
defaultValue float64
}
// getName returns the full name of the float32 argument.
func (f *floatArgument) getName() string {
return f.name
}
// getShort returns the abbreviated name of the float32 argument.
func (f *floatArgument) getShort() string {
return f.short
}
// getGroup returns the group name of the float32 argument.
func (f *floatArgument) getGroup() string {
return f.group
}
// getHelp returns the help text of the float32 argument.
func (f *floatArgument) getHelp() string {
return f.help
}