-
Notifications
You must be signed in to change notification settings - Fork 16
/
string_slice_options.go
79 lines (71 loc) · 2.24 KB
/
string_slice_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
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
package goflags
// StringSliceOptions represents the default string slice (list of items)
// Tokenization: None
// Normalization: None
// Type: []string
// Example: -flag value1 -flag value2 => {"value1", "value2"}
var StringSliceOptions = Options{}
// CommaSeparatedStringSliceOptions represents a list of comma separated items
// Tokenization: Comma
// Normalization: None
// Type: []string
// Example: -flag value1,value2 => {"value1", "value2"}
var CommaSeparatedStringSliceOptions = Options{
IsEmpty: isEmpty,
}
// FileCommaSeparatedStringSliceOptions represents a list of comma separated files containing items
// Tokenization: Comma
// Normalization: None
// Type: []string
// test.txt content:
// value1
// value2
//
// Example: -flag test.txt => {"value1", "value2"}
var FileCommaSeparatedStringSliceOptions = Options{
IsEmpty: isEmpty,
IsFromFile: isFromFile,
}
// NormalizedOriginalStringSliceOptions represents a list of items
// Tokenization: None
// Normalization: Standard
// Type: []string
// Example: -flag /value/1 -flag 'value2' => {"/value/1", "value2"}
var NormalizedOriginalStringSliceOptions = Options{
IsEmpty: isEmpty,
Normalize: normalize,
}
// FileNormalizedStringSliceOptions represents a list of path items
// Tokenization: Comma
// Normalization: Standard
// Type: []string
// Example: -flag /value/1 -flag value2 => {"/value/1", "value2"}
var FileNormalizedStringSliceOptions = Options{
IsEmpty: isEmpty,
Normalize: normalizeLowercase,
IsFromFile: isFromFile,
}
// FileStringSliceOptions represents a list of items stored in a file
// Tokenization: Standard
// Normalization: Standard
var FileStringSliceOptions = Options{
IsEmpty: isEmpty,
Normalize: normalizeTrailingParts,
IsFromFile: isFromFile,
IsRaw: func(s string) bool { return true },
}
// NormalizedStringSliceOptions represents a list of items
// Tokenization: Comma
// Normalization: Standard
var NormalizedStringSliceOptions = Options{
IsEmpty: isEmpty,
Normalize: normalizeLowercase,
}
// FileNormalizedOriginalStringSliceOptions represents a list of items stored in a file
// Tokenization: Comma
// Normalization: Standard
var FileNormalizedOriginalStringSliceOptions = Options{
IsEmpty: isEmpty,
Normalize: normalize,
IsFromFile: isFromFile,
}