fix: command delimiter to support pipelining (#114)

* fix: command delimiter to support pipelining

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

* test: pipeline parsing

Signed-off-by: Chapman Pendery <cpendery@vt.edu>

---------

Signed-off-by: Chapman Pendery <cpendery@vt.edu>
This commit is contained in:
Chapman Pendery
2023-12-12 11:45:15 -08:00
committed by GitHub
parent e8053bac5f
commit 6f52657217
3 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ export type CommandToken = {
isPersistent?: boolean;
};
const cmdDelim = /(\|\|)|(&&)|(;)/;
const cmdDelim = /(\|\|)|(&&)|(;)|(\|)/;
const spaceRegex = /\s/;
export const parseCommand = (command: string): CommandToken[] => {
@@ -319,3 +319,13 @@ exports[`parseCommand cmd value 1`] = `
},
]
`;
exports[`parseCommand cmd1 | cmd2 1`] = `
[
{
"complete": true,
"isOption": false,
"token": "cmd2",
},
]
`;
+1
View File
@@ -23,6 +23,7 @@ const testData = [
{ command: `cmd ` },
{ command: `cmd "value' ` },
{ command: `cmd "value'\\"\\"" ` },
{ command: `cmd1 | cmd2 ` },
];
describe(`parseCommand`, () => {