-
Notifications
You must be signed in to change notification settings - Fork 0
/
aguments.go
47 lines (40 loc) · 883 Bytes
/
aguments.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
package gocli
const (
ArgumentTypeString = "string"
ArgumentTypeInt = "int"
ArgumentTypeUint = "uint"
ArgumentTypeBool = "bool"
)
// Arguments Console app arguments
type Arguments map[string]Argument
// Argument struct
type Argument struct {
// Type of argument
Type string
// Value of argument
Value interface{}
// Label of argument
Label string
// Name of argument
Name string
}
// GetString Get string value of argument
func (a Argument) GetString() string {
value := a.Value.(*string)
return *value
}
// GetInt Get int value of argument
func (a Argument) GetInt() int64 {
value := a.Value.(*int64)
return *value
}
// GetUnit Get int value of argument
func (a Argument) GetUnit() uint64 {
value := a.Value.(*uint64)
return *value
}
// GetBool Get bool value of argument
func (a Argument) GetBool() bool {
value := a.Value.(*bool)
return *value
}