-
Notifications
You must be signed in to change notification settings - Fork 3
/
options.go
37 lines (32 loc) · 897 Bytes
/
options.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
package tagalign
type Option func(*Helper)
// WithMode specify the mode of tagalign.
func WithMode(mode Mode) Option {
return func(h *Helper) {
h.mode = mode
}
}
// WithSort enable tags sort.
// fixedOrder specify the order of tags, the other tags will be sorted by name.
// Sory is disabled by default.
func WithSort(fixedOrder ...string) Option {
return func(h *Helper) {
h.sort = true
h.fixedTagOrder = fixedOrder
}
}
// WithAlign configure whether enable tags align.
// Align is enabled by default.
func WithAlign(enabled bool) Option {
return func(h *Helper) {
h.align = enabled
}
}
// WithStrictStyle configure whether enable strict style.
// StrictStyle is disabled by default.
// Note: StrictStyle must be used with WithAlign(true) and WithSort(...) together, or it will be ignored.
func WithStrictStyle() Option {
return func(h *Helper) {
h.style = StrictStyle
}
}