-
Notifications
You must be signed in to change notification settings - Fork 44
/
builtin.go
47 lines (38 loc) · 1.11 KB
/
builtin.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 cli
import (
"fmt"
)
// Helper is builtin Help flag
type Helper struct {
Help bool `cli:"!h,help" usage:"display help information" json:"-"`
}
// AutoHelp implements AutoHelper interface
func (h Helper) AutoHelp() bool {
return h.Help
}
// Helper2 is builtin Help flag
type Helper2 struct {
Help bool `cli:"!h,help" usage:"Display help information" json:"-"`
}
// AutoHelp implements AutoHelper interface
func (h Helper2) AutoHelp() bool {
return h.Help
}
// Deprecated: Addr is builtin host,port flag
type Addr struct {
Host string `cli:"host" usage:"specify host" dft:"0.0.0.0"`
Port uint16 `cli:"port" usage:"specify port" dft:"8080"`
}
// Deprecated: AddrWithShort is builtin host,port flag contains short flag
type AddrWithShort struct {
Host string `cli:"H,host" usage:"specify host" dft:"0.0.0.0"`
Port uint16 `cli:"p,port" usage:"specify port" dft:"8080"`
}
// Deprecated: ToString ...
func (addr Addr) ToString() string {
return fmt.Sprintf("%s:%d", addr.Host, addr.Port)
}
// Deprecated: ToString ...
func (addr AddrWithShort) ToString() string {
return fmt.Sprintf("%s:%d", addr.Host, addr.Port)
}