Merge pull request #2227 from FaintSpeaker/alias-regex-not-matching-exactly

Alias command regular expression mismatch
This commit is contained in:
hydroflame 2022-01-02 11:41:50 -05:00 committed by GitHub
commit 01cb0cca81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -38,13 +38,14 @@ export function printAliases(): void {
export function parseAliasDeclaration(dec: string, global = false): boolean { export function parseAliasDeclaration(dec: string, global = false): boolean {
const re = /^([\w|!|%|,|@|-]+)=(("(.+)")|('(.+)'))$/; const re = /^([\w|!|%|,|@|-]+)=(("(.+)")|('(.+)'))$/;
const matches = dec.match(re); const matches = dec.match(re);
if (matches == null || matches.length != 3) { if (matches == null || matches.length != 7) {
return false; return false;
} }
if (global) { if (global) {
addGlobalAlias(matches[1], matches[2]); addGlobalAlias(matches[1], matches[4] || matches[6]);
} else { } else {
addAlias(matches[1], matches[2]); addAlias(matches[1], matches[4] || matches[6]);
} }
return true; return true;
} }