Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 | 2x 2x 2x 9x 9x 13x 13x 12x 12x 12x 12x 9x | const MATCHES_PROC_VALUE = /^([-_\w\d]+):\s*(.+)$/;
const MATCHES_WHITESPACE = /\s+/g;
export interface Command {
command: string;
options: ReadonlyArray<string>;
}
export const parse = (data: string) => {
const procs: {[i: string]: Command} = {};
data.split('\n').forEach((line) => {
const match = MATCHES_PROC_VALUE.exec(line);
if (match) {
const name = match[1].trim();
const details = match[2].trim().split(MATCHES_WHITESPACE);
const [command, ...options] = details;
procs[name] = {
command,
options,
};
}
});
return procs;
};
|