Parcourir la source

renamed option

Former-commit-id: df246e13cc210fac847c757d9c839fc8ef0734e7
Gildas il y a 5 ans
Parent
commit
2895787fef
3 fichiers modifiés avec 6 ajouts et 6 suppressions
  1. 1 1
      cli/README.MD
  2. 4 4
      cli/args.js
  3. 1 1
      cli/single-file

+ 1 - 1
cli/README.MD

@@ -66,7 +66,7 @@ SingleFile can be launched from the command line by running it into a (headless)
 
   - Save https://www.wikipedia.org and crawl its internal links with the query parameters removed from the URL
 
-  `single-file https://www.wikipedia.org --crawl-links=true --crawl-inner-links-only=true  --crawl-max-depth=1 --url-rewrite-rules="^(.*)\\?.*$ $1"`
+  `single-file https://www.wikipedia.org --crawl-links=true --crawl-inner-links-only=true  --crawl-max-depth=1 --crawl-rewrite-rules="^(.*)\\?.*$ $1"`
   
 ## Troubleshooting
 

+ 4 - 4
cli/args.js

@@ -72,7 +72,7 @@ const args = require("yargs")
 		"crawl-inner-links-only": true,
 		"crawl-max-depth": 1,
 		"crawl-replace-urls": false,
-		"url-rewrite-rules": []
+		"crawl-rewrite-rules": []
 	})
 	.options("back-end", { description: "Back-end to use" })
 	.choices("back-end", ["jsdom", "puppeteer", "webdriver-chromium", "webdriver-gecko"])
@@ -112,6 +112,8 @@ const args = require("yargs")
 	.number("crawl-external-links-max-depth")
 	.options("crawl-replace-urls", { description: "Replace URLs of saved pages with relative paths of saved pages on the filesystem" })
 	.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("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)" })
@@ -158,9 +160,7 @@ const args = require("yargs")
 	.options("remove-alternative-images", { description: "Remove images for alternative sizes of screen" })
 	.boolean("remove-alternative-images")
 	.options("save-raw-page", { description: "Save the original page without interpreting it into the browser (puppeteer, webdriver-gecko, webdriver-chromium)" })
-	.boolean("save-raw-page")
-	.options("url-rewrite-rules", { description: "List of rewrite rules used to rewrite URLs" })
-	.array("url-rewrite-rules")
+	.boolean("save-raw-page")	
 	.options("urls-file", { description: "Path to a text file containing a list of URLs (separated by a newline) to save" })
 	.string("urls-file")
 	.options("user-agent", { description: "User-agent of the browser (puppeteer, webdriver-gecko, webdriver-chromium)" })

+ 1 - 1
cli/single-file

@@ -134,7 +134,7 @@ function createTask(url, parentTask, rootTask) {
 
 function rewriteURL(url) {
 	url = url.trim();
-	options.urlRewriteRules.forEach(rewriteRule => {
+	options.crawlRewriteRules.forEach(rewriteRule => {
 		const parts = rewriteRule.trim().split(/ +/);
 		if (parts.length == 2) {
 			url = url.replace(new RegExp(parts[0]), parts[1]).trim();