This repository was archived by the owner on Oct 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtree_printer_options.go
More file actions
46 lines (40 loc) · 1.41 KB
/
tree_printer_options.go
File metadata and controls
46 lines (40 loc) · 1.41 KB
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
// Package afmt (Advanced formatter or Advanced fmt) implement some extensions
// for fmt package. The main feature is print to tree structure.
package afmt
// TreePrinterOptions are used for Server construct function.
type TreePrinterOptions struct {
// Ignore unsupported types, otherwise return error
IgnoreUnsupported bool
// Padding by spaces
Padding uint
// Pretty name for printer
PrettyNames map[string]string
// Ignore specified parts of structure (do not print these ones)
IgnoreNames []string
}
// TreePrinterOption specification for Printer package.
type TreePrinterOption func(*TreePrinterOptions)
// TreePrinterOptionIgnoreUnsupported option specification.
func TreePrinterOptionIgnoreUnsupported(ignoreUnsupported bool) TreePrinterOption {
return func(opts *TreePrinterOptions) {
opts.IgnoreUnsupported = ignoreUnsupported
}
}
// TreePrinterOptionPadding option specification.
func TreePrinterOptionPadding(padding uint) TreePrinterOption {
return func(opts *TreePrinterOptions) {
opts.Padding = padding
}
}
// TreePrinterOptionPrettyNames option specification.
func TreePrinterOptionPrettyNames(names map[string]string) TreePrinterOption {
return func(opts *TreePrinterOptions) {
opts.PrettyNames = names
}
}
// TreePrinterOptionIgnoreNames option specification.
func TreePrinterOptionIgnoreNames(names []string) TreePrinterOption {
return func(opts *TreePrinterOptions) {
opts.IgnoreNames = names
}
}