-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathtr.ts
187 lines (185 loc) · 3.87 KB
/
tr.ts
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
const stringSuggestions: Fig.Suggestion[] = [
{
name: "a",
description: "Any single character",
priority: 40,
},
{
name: "\\a",
description: "Alert character",
priority: 39,
},
{
name: "\\b",
description: "Backspace character",
priority: 39,
},
{
name: "\\f",
description: "Form feed character",
priority: 39,
},
{
name: "\\n",
description: "Newline character",
priority: 39,
},
{
name: "\\r",
description: "Carriage return character",
priority: 39,
},
{
name: "\\t",
description: "Tab character",
priority: 39,
},
{
name: "\\v",
description: "Vertical tab character",
priority: 39,
},
{
name: "c-c",
description:
"For non-octal range endpoints represents the range of characters between the range endpoints, inclusive, in ascending order, as defined by the collation sequence",
priority: 38,
},
{
name: "[:alnum:]",
description: "Alphanumeric characters",
priority: 37,
},
{
name: "[:alpha:]",
description: "Alphabetic characters",
priority: 37,
},
{
name: "[:blank:]",
description: "Blank characters",
priority: 37,
},
{
name: "[:cntrl:]",
description: "Control characters",
priority: 37,
},
{
name: "[:digit:]",
description: "Digit characters",
priority: 37,
},
{
name: "[:graph:]",
description: "Graphic characters",
priority: 37,
},
{
name: "[:ideogram:]",
description: "Ideographic characters",
priority: 37,
},
{
name: "[:lower:]",
description: "Lower-case characters",
priority: 37,
},
{
name: "[:phonogram:]",
description: "Phonographic characters",
priority: 37,
},
{
name: "[:print:]",
description: "Printable characters",
priority: 37,
},
{
name: "[:punct:]",
description: "Punctuation characters",
priority: 37,
},
{
name: "[:rune:]",
description: "Valid characters",
priority: 37,
},
{
name: "[:space:]",
description: "Space characters",
priority: 37,
},
{
name: "[:special:]",
description: "Special characters",
priority: 37,
},
{
name: "[:upper:]",
description: "Upper-case characters",
priority: 37,
},
{
name: "[:xdigit:]",
description: "Hexadecimal characters",
priority: 37,
},
{
name: "[=equiv=]",
description:
"Represents all characters belonging to the same equivalence class as 'equiv', ordered by their encoded values",
priority: 36,
},
{
name: "[#*n]",
description:
"Represents 'n' repeated occurrences of the character represented by '#'",
priority: 35,
},
];
const completionSpec: Fig.Spec = {
name: "tr",
description: "Translate characters",
parserDirectives: {
optionsMustPrecedeArguments: true,
},
options: [
{
name: "-C",
description:
"Complement the set of characters in string1, that is '-C ab' includes every character except for 'a' and 'b'",
},
{
name: "-c",
description: "Same as '-C' but complement the set of values in string1",
},
{
name: "-d",
description: "Delete characters in string1 from the input",
},
{
name: "-s",
description:
"Squeeze multiple occurrences of the characters listed in the last operand (either string1 or string2) in the input into a single instance of the character. This occurs after all deletion and translation is completed",
},
{
name: "-u",
description: "Guarantee that any output is unbuffered",
},
],
args: [
{
name: "string1",
description: "Candidate string",
suggestions: stringSuggestions,
},
{
name: "string2",
description: "Replacment string",
isOptional: true,
suggestions: stringSuggestions,
},
],
};
export default completionSpec;