mirror of
https://github.com/wavetermdev/inshellisense.git
synced 2026-08-05 13:43:30 -07:00
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:
@@ -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",
|
||||
},
|
||||
]
|
||||
`;
|
||||
|
||||
@@ -23,6 +23,7 @@ const testData = [
|
||||
{ command: `cmd ` },
|
||||
{ command: `cmd "value' ` },
|
||||
{ command: `cmd "value'\\"\\"" ` },
|
||||
{ command: `cmd1 | cmd2 ` },
|
||||
];
|
||||
|
||||
describe(`parseCommand`, () => {
|
||||
|
||||
Reference in New Issue
Block a user