Kaynağa Gözat

replace --crawl-rewrite-rules with --crawl-rewrite-rule

Gildas 5 yıl önce
ebeveyn
işleme
d3a8d3f852
2 değiştirilmiş dosya ile 8 ekleme ve 7 silme
  1. 2 2
      cli/README.MD
  2. 6 5
      cli/args.js

+ 2 - 2
cli/README.MD

@@ -105,11 +105,11 @@ 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 --crawl-rewrite-rules="^(.*)\\?.*$ $1"`
+  `single-file https://www.wikipedia.org --crawl-links=true --crawl-inner-links-only=true --crawl-max-depth=1 --crawl-rewrite-rule="^(.*)\\?.*$ $1"`
 
   - Save https://www.wikipedia.org and external links only
 
-  `single-file https://www.wikipedia.org --crawl-links=true --crawl-inner-links-only=false --crawl-external-links-max-depth=1 --crawl-rewrite-rules="^.*wikipedia.*$"`
+  `single-file https://www.wikipedia.org --crawl-links=true --crawl-inner-links-only=false --crawl-external-links-max-depth=1 --crawl-rewrite-rule="^.*wikipedia.*$"`
   
 ## Troubleshooting
 

+ 6 - 5
cli/args.js

@@ -79,7 +79,7 @@ const args = require("yargs")
 		"crawl-max-depth": 1,
 		"crawl-external-links-max-depth": 1,
 		"crawl-replace-urls": false,
-		"crawl-rewrite-rules": [],
+		"crawl-rewrite-rule": [],
 		"output-directory": ""
 	})
 	.options("back-end", { description: "Back-end to use" })
@@ -132,8 +132,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("crawl-rewrite-rule", { description: "Rewrite rule used to rewrite URLs of crawled pages" })
+	.array("crawl-rewrite-rule")
 	.options("dump-content", { description: "Dump the content of the processed page in the console" })
 	.boolean("dump-content")
 	.options("error-file")
@@ -231,9 +231,10 @@ args.browserCookies = cookies.map(cookieValue => {
 		url: value[8] || undefined
 	};
 });
-const scripts = args.browserScript;
+args.browserScripts = args.browserScript;
 delete args.browserScript;
-args.browserScripts = scripts;
+args.crawlRewriteRules = args.crawlRewriteRule;
+delete args.crawlRewriteRule;
 Object.keys(args).filter(optionName => optionName.includes("-"))
 	.forEach(optionName => delete args[optionName]);
 delete args["$0"];