@@ -241,42 +241,38 @@ const handleCombinedLuaProfiles = (
241241} ;
242242
243243function captureRenderCommand (
244- args : Deno . RunOptions ,
244+ args : Deno . CommandOptions ,
245245 temp : TempContext ,
246246 outputDir : string ,
247247) {
248248 Deno . mkdirSync ( outputDir , { recursive : true } ) ;
249- const newArgs = [
250- args . cmd [ 0 ] ,
251- ...args . cmd . slice ( 1 ) . map ( ( _arg ) => {
252- const arg = _arg as string ; // we know it's a string, TypeScript doesn't somehow
253- if ( ! arg . startsWith ( temp . baseDir ) ) {
254- return arg ;
255- }
256- const newArg = join ( outputDir , basename ( arg ) ) ;
257- if ( arg . match ( / ^ .* q u a r t o \- d e f a u l t s .* .y m l $ / ) ) {
258- // we need to correct the defaults YML because it contains a reference to a template in a temp directory
259- const ymlDefaults = Deno . readTextFileSync ( arg ) ;
260- const defaults = parseYml ( ymlDefaults ) ;
261-
262- const templateDirectory = dirname ( defaults . template ) ;
263- const newTemplateDirectory = join (
264- outputDir ,
265- basename ( templateDirectory ) ,
266- ) ;
267- copyTo ( templateDirectory , newTemplateDirectory ) ;
268- defaults . template = join (
269- newTemplateDirectory ,
270- basename ( defaults . template ) ,
271- ) ;
272- const defaultsOutputFile = join ( outputDir , basename ( arg ) ) ;
273- Deno . writeTextFileSync ( defaultsOutputFile , stringify ( defaults ) ) ;
274- return defaultsOutputFile ;
275- }
276- Deno . copyFileSync ( arg , newArg ) ;
277- return newArg ;
278- } ) ,
279- ] as typeof args . cmd ;
249+ const newArgs : typeof args . args = ( args . args ?? [ ] ) . map ( ( _arg ) => {
250+ const arg = _arg as string ; // we know it's a string, TypeScript doesn't somehow
251+ if ( ! arg . startsWith ( temp . baseDir ) ) {
252+ return arg ;
253+ }
254+ const newArg = join ( outputDir , basename ( arg ) ) ;
255+ if ( arg . match ( / ^ .* q u a r t o \- d e f a u l t s .* .y m l $ / ) ) {
256+ // we need to correct the defaults YML because it contains a reference to a template in a temp directory
257+ const ymlDefaults = Deno . readTextFileSync ( arg ) ;
258+ const defaults = parseYml ( ymlDefaults ) ;
259+ const templateDirectory = dirname ( defaults . template ) ;
260+ const newTemplateDirectory = join (
261+ outputDir ,
262+ basename ( templateDirectory ) ,
263+ ) ;
264+ copyTo ( templateDirectory , newTemplateDirectory ) ;
265+ defaults . template = join (
266+ newTemplateDirectory ,
267+ basename ( defaults . template ) ,
268+ ) ;
269+ const defaultsOutputFile = join ( outputDir , basename ( arg ) ) ;
270+ Deno . writeTextFileSync ( defaultsOutputFile , stringify ( defaults ) ) ;
271+ return defaultsOutputFile ;
272+ }
273+ Deno . copyFileSync ( arg , newArg ) ;
274+ return newArg ;
275+ } ) ;
280276
281277 // now we need to correct entries in filterParams
282278 const filterParams = JSON . parse (
@@ -1322,7 +1318,8 @@ export async function runPandoc(
13221318 setupPandocEnv ( ) ;
13231319
13241320 const params = {
1325- cmd,
1321+ cmd : cmd [ 0 ] ,
1322+ args : cmd . slice ( 1 ) ,
13261323 cwd,
13271324 env : pandocEnv ,
13281325 ourEnv : Deno . env . toObject ( ) ,
0 commit comments