184
let headerSeen = false;
185
for (const rawLine of lines) {
187
>
if (!line.trim()) {
188
continue;
189
}
191
>
// whitespace where the `* ` marker would otherwise appear). Skip
192
>
// it once seen; any subsequent NAME-headed row is data.
193
>
if (!headerSeen) {
194
>
const upper = line.trim().toUpperCase();
195
>
if (upper.startsWith('NAME')) {
196
>
headerSeen = true;
197
>
continue;
198
>
}
199
>
}
200
>
let working = line;
201
>
let isDefault = false;
202
>
if (working.startsWith('* ') || working.startsWith('*\t')) {
203
>
isDefault = true;
204
>
working = working.slice(2);
205
>
} else if (working.startsWith(' ') || working.startsWith(' \t')) {
206
working = working.slice(2);
207
} else if (working.startsWith(' ')) {
208
working = working.slice(1);
209
}
211
>
if (columns.length < 3) {
212
continue;
213
}
215
>
if (version !== 2) {
216
continue;
217
}
219
>
const name = columns.slice(0, columns.length - 2).join(' ');
220
>
if (!name) {
221
continue;
222
}
224
>
name,
225
>
isDefault,
226
>
isRunning: state.toLowerCase() === 'running',
227
>
version: 2,
228
>
});
229
>
}
230
>
return distros;
231
>
}
232
233
/**