ソースを参照

[breaking] Change CLI arguments

jherve 1 年間 前
コミット
d75887cbc6
1 ファイル変更7 行追加3 行削除
  1. 7 3
      to_pdf.js

+ 7 - 3
to_pdf.js

@@ -56,12 +56,16 @@ function exportRenderToPdf(dataFilePath, templatePath, assetsPath, outputPath, o
   console.log(`Wrote PDF file to ${pdfPath}`);
 }
 
-const [dataFilePath, templatePath, assetsPath, outputPath] = process.argv.slice(2);
-if (!dataFilePath || !templatePath || !assetsPath || !outputPath) {
+const [inputPath, templateName, variantName, outputPath] = process.argv.slice(2);
+if (!inputPath || !templateName || !variantName || !outputPath) {
   console.error(
-    `The script should be called like :\n${process.argv[1]} resume_path template_path assets_dir output_dir`
+    `The script should be called like :\n${process.argv[1]} input_path template_name variant_name output_dir`
   );
   process.exit(1);
 }
 
+const dataFilePath = path.join(inputPath, `${variantName}.yaml`);
+const templatePath = path.join(inputPath, `${templateName}.pug`);
+const assetsPath = path.join(inputPath, "assets");
+
 exportRenderToPdf(dataFilePath, templatePath, assetsPath, outputPath, "resume");