Просмотр исходного кода

added "--dump-content" flag (CLI)

Gildas 5 лет назад
Родитель
Сommit
e2e15381a6
3 измененных файлов с 8 добавлено и 2 удалено
  1. 1 1
      cli/README.MD
  2. 6 0
      cli/args.js
  3. 1 1
      cli/dockerfile

+ 1 - 1
cli/README.MD

@@ -62,7 +62,7 @@ SingleFile can be launched from the command line by running it into a (headless)
 
   - Dump the processed content of https://www.wikipedia.org into the console
 
-  `single-file https://www.wikipedia.org --filename-template=""`
+  `single-file https://www.wikipedia.org --dump-content`
 
   - Save https://www.wikipedia.org into `wikipedia.html` in the current folder
 

+ 6 - 0
cli/args.js

@@ -44,6 +44,7 @@ const args = require("yargs")
 		"browser-args": "",
 		"compress-CSS": false,
 		"compress-HTML": true,
+		"dump-content": false,
 		"filename-template": "{page-title} ({date-iso} {time-locale}).html",
 		"filename-replacement-character": "_",
 		"group-duplicate-images": true,
@@ -119,6 +120,8 @@ const args = require("yargs")
 	.boolean("crawl-replace-urls")
 	.options("crawl-rewrite-rules", { description: "List of rewrite rules used to rewrite URLs of internal and external links" })
 	.array("crawl-rewrite-rules")
+	.options("dump-content", { description: "Dump the content of the processed page in the console" })
+	.boolean("dump-content")
 	.options("error-file")
 	.string("error-file")
 	.options("filename-template", { description: "Template used to generate the output filename (see help page of the extension for more info)" })
@@ -177,6 +180,9 @@ const args = require("yargs")
 	.options("web-driver-executable-path", { description: "Path to Selenium WebDriver executable (webdriver-gecko, webdriver-chromium)" })
 	.string("web-driver-executable-path")
 	.argv;
+if (args.dumpContent) {
+	args.filenameTemplate = "";
+}
 args.compressCSS = args.compressCss;
 args.compressHTML = args.compressHtml;
 args.includeBOM = args.includeBom;

+ 1 - 1
cli/dockerfile

@@ -9,5 +9,5 @@ RUN set -x \
     
 WORKDIR /usr/src/app/SingleFile/cli
 
-ENTRYPOINT ["./single-file", "--browser-executable-path", "/usr/bin/chromium-browser", "--filename-template=''", "--browser-args", "[\"--no-sandbox\"]"]
+ENTRYPOINT ["./single-file", "--browser-executable-path", "/usr/bin/chromium-browser", "--dump-content", "--browser-args", "[\"--no-sandbox\"]"]
 CMD ["https://github.com/Zenika/alpine-chrome"]