diff --git a/package.json b/package.json index 02d2ec41..c66c522f 100644 --- a/package.json +++ b/package.json @@ -58,27 +58,27 @@ "dependencies": { "chalk": "4.1.2", "rxjs": "7.8.2", - "shell-quote": "1.8.1", + "shell-quote": "1.8.3", "supports-color": "8.1.1", "tree-kill": "1.2.2", "yargs": "17.7.2" }, "devDependencies": { - "@eslint/js": "9.33.0", + "@eslint/js": "^9.33.0", "@hirez_io/observer-spy": "^2.2.0", "@types/node": "^18.19.123", "@types/shell-quote": "^1.7.5", "@types/supports-color": "^8.1.3", "@types/yargs": "^17.0.33", "@vitest/coverage-v8": "^3.2.4", - "@vitest/eslint-plugin": "1.3.4", + "@vitest/eslint-plugin": "^1.3.4", "coveralls-next": "^5.0.0", "ctrlc-wrapper": "^0.0.5", "esbuild": "~0.25.9", "eslint": "^9.33.0", - "eslint-config-flat-gitignore": "2.1.0", + "eslint-config-flat-gitignore": "^2.1.0", "eslint-config-prettier": "^10.1.8", - "eslint-plugin-import-lite": "0.3.0", + "eslint-plugin-import-lite": "^0.3.0", "eslint-plugin-prettier": "^5.5.4", "eslint-plugin-simple-import-sort": "^12.1.1", "globals": "16.3.0", @@ -88,7 +88,7 @@ "safe-publish-latest": "^2.0.0", "string-argv": "^0.3.2", "typescript": "~5.9.2", - "typescript-eslint": "8.40.0", + "typescript-eslint": "^8.40.0", "vitest": "^3.2.4" }, "files": [ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6fe21253..54fcea8d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,8 +15,8 @@ importers: specifier: 7.8.2 version: 7.8.2 shell-quote: - specifier: 1.8.1 - version: 1.8.1 + specifier: 1.8.3 + version: 1.8.3 supports-color: specifier: 8.1.1 version: 8.1.1 @@ -28,7 +28,7 @@ importers: version: 17.7.2 devDependencies: '@eslint/js': - specifier: 9.33.0 + specifier: ^9.33.0 version: 9.33.0 '@hirez_io/observer-spy': specifier: ^2.2.0 @@ -49,7 +49,7 @@ importers: specifier: ^3.2.4 version: 3.2.4(supports-color@8.1.1)(vitest@3.2.4(@types/node@18.19.123)(supports-color@8.1.1)(yaml@2.8.1)) '@vitest/eslint-plugin': - specifier: 1.3.4 + specifier: ^1.3.4 version: 1.3.4(eslint@9.33.0(supports-color@8.1.1))(supports-color@8.1.1)(typescript@5.9.2)(vitest@3.2.4(@types/node@18.19.123)(supports-color@8.1.1)(yaml@2.8.1)) coveralls-next: specifier: ^5.0.0 @@ -64,13 +64,13 @@ importers: specifier: ^9.33.0 version: 9.33.0(supports-color@8.1.1) eslint-config-flat-gitignore: - specifier: 2.1.0 + specifier: ^2.1.0 version: 2.1.0(eslint@9.33.0(supports-color@8.1.1)) eslint-config-prettier: specifier: ^10.1.8 version: 10.1.8(eslint@9.33.0(supports-color@8.1.1)) eslint-plugin-import-lite: - specifier: 0.3.0 + specifier: ^0.3.0 version: 0.3.0(eslint@9.33.0(supports-color@8.1.1))(typescript@5.9.2) eslint-plugin-prettier: specifier: ^5.5.4 @@ -100,7 +100,7 @@ importers: specifier: ~5.9.2 version: 5.9.2 typescript-eslint: - specifier: 8.40.0 + specifier: ^8.40.0 version: 8.40.0(eslint@9.33.0(supports-color@8.1.1))(supports-color@8.1.1)(typescript@5.9.2) vitest: specifier: ^3.2.4 @@ -305,10 +305,6 @@ packages: peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 - '@eslint-community/regexpp@4.11.0': - resolution: {integrity: sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==} - engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} - '@eslint-community/regexpp@4.12.1': resolution: {integrity: sha512-CCZCDJuduB9OUkFkY2IgppNZMi2lBQgD2qzwXkEia16cge2pijY/aXi96CJMquDMn3nJdlPV1A5KrJEXwfLNzQ==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} @@ -1384,8 +1380,9 @@ packages: resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} engines: {node: '>=8'} - shell-quote@1.8.1: - resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==} + shell-quote@1.8.3: + resolution: {integrity: sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==} + engines: {node: '>= 0.4'} siginfo@2.0.0: resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} @@ -1750,8 +1747,6 @@ snapshots: eslint: 9.33.0(supports-color@8.1.1) eslint-visitor-keys: 3.4.3 - '@eslint-community/regexpp@4.11.0': {} - '@eslint-community/regexpp@4.12.1': {} '@eslint/compat@1.3.2(eslint@9.33.0(supports-color@8.1.1))': @@ -1949,7 +1944,7 @@ snapshots: '@typescript-eslint/eslint-plugin@8.40.0(@typescript-eslint/parser@8.40.0(eslint@9.33.0(supports-color@8.1.1))(supports-color@8.1.1)(typescript@5.9.2))(eslint@9.33.0(supports-color@8.1.1))(supports-color@8.1.1)(typescript@5.9.2)': dependencies: - '@eslint-community/regexpp': 4.11.0 + '@eslint-community/regexpp': 4.12.1 '@typescript-eslint/parser': 8.40.0(eslint@9.33.0(supports-color@8.1.1))(supports-color@8.1.1)(typescript@5.9.2) '@typescript-eslint/scope-manager': 8.40.0 '@typescript-eslint/type-utils': 8.40.0(eslint@9.33.0(supports-color@8.1.1))(supports-color@8.1.1)(typescript@5.9.2) @@ -2821,7 +2816,7 @@ snapshots: shebang-regex@3.0.0: {} - shell-quote@1.8.1: {} + shell-quote@1.8.3: {} siginfo@2.0.0: {} diff --git a/src/command-parser/expand-arguments.ts b/src/command-parser/expand-arguments.ts index 2e9e77ad..e3d65d33 100644 --- a/src/command-parser/expand-arguments.ts +++ b/src/command-parser/expand-arguments.ts @@ -17,21 +17,27 @@ export class ExpandArguments implements CommandParser { if (match.startsWith('\\')) { return match.slice(1); } - // Replace numeric placeholder if value exists in additional arguments. - if ( - !isNaN(placeholderTarget) && - placeholderTarget <= this.additionalArguments.length - ) { - return quote([this.additionalArguments[placeholderTarget - 1]]); - } - // Replace all arguments placeholder. - if (placeholderTarget === '@') { - return quote(this.additionalArguments); - } - // Replace combined arguments placeholder. - if (placeholderTarget === '*') { - return quote([this.additionalArguments.join(' ')]); + + if (this.additionalArguments.length > 0) { + // Replace numeric placeholder if value exists in additional arguments. + if ( + !isNaN(placeholderTarget) && + placeholderTarget <= this.additionalArguments.length + ) { + return quote([this.additionalArguments[placeholderTarget - 1]]); + } + + // Replace all arguments placeholder. + if (placeholderTarget === '@') { + return quote(this.additionalArguments); + } + + // Replace combined arguments placeholder. + if (placeholderTarget === '*') { + return quote([this.additionalArguments.join(' ')]); + } } + // Replace placeholder with empty string // if value doesn't exist in additional arguments. return '';