Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

refactor(cli): remove noscript alias

ldm020b52a1e8be3
diff --git a/moli/src/cli.rs b/moli/src/cli.rs
index 2bbcf72d1..863df6f19 100644
--- a/moli/src/cli.rs
+++ b/moli/src/cli.rs
@@ -47,9 +47,6 @@ pub struct FetchArgs {
#[arg(short = 'H', long = "header", value_name = "HEADER", value_parser = parse_request_header_arg)]
pub headers: Vec<RequestHeaderArg>,
- #[arg(long)]
- pub noscript: bool,
-
#[arg(long)]
pub with_base: bool,
@@ -171,10 +168,6 @@ impl FetchArgs {
pub fn strip_options(&self) -> StripOptions {
let mut strip = StripOptions::default();
- if self.noscript {
- strip.js = true;
- }
-
for mode in &self.strip_mode {
match mode {
StripModeChoice::Js => strip.js = true,
@@ -735,7 +728,6 @@ mod tests {
"main",
"--timeout",
"5000",
- "--noscript",
"--layout",
"--image",
"--font",
@@ -760,7 +752,6 @@ mod tests {
"main",
"-t",
"5000",
- "--noscript",
"-l",
"--image",
"--font",
diff --git a/moli/tests/cli.rs b/moli/tests/cli.rs
index f1be3ebe5..6110ac713 100644
--- a/moli/tests/cli.rs
+++ b/moli/tests/cli.rs
@@ -34,11 +34,10 @@ fn parses_explicit_fetch_command_with_compatibility_flags() {
"X-Test: one",
"-H",
"X-Trace: two",
- "--noscript",
"--with-base",
"--with-frames",
"--strip-mode",
- "css,ui",
+ "js,css,ui",
"--obey-robots",
"--http-proxy",
"http://proxy.internal:8080",
@@ -84,12 +83,15 @@ fn parses_explicit_fetch_command_with_compatibility_flags() {
value: "two".to_owned(),
},
],
- noscript: true,
with_base: true,
with_frames: true,
trace_network: false,
trace_matched_response_body: false,
- strip_mode: vec![StripModeChoice::Css, StripModeChoice::Ui],
+ strip_mode: vec![
+ StripModeChoice::Js,
+ StripModeChoice::Css,
+ StripModeChoice::Ui,
+ ],
wait_until: FetchWaitUntil::Done,
redirect_wait_ms: 1_000,
wait_selector: None,
@@ -413,7 +415,6 @@ fn infers_fetch_mode_from_bare_url() {
Commands::Fetch(Box::new(FetchArgs {
dump: None,
headers: vec![],
- noscript: false,
with_base: false,
with_frames: false,
trace_network: false,
@@ -453,7 +454,6 @@ fn parses_bare_dump_with_explicit_fetch_command_and_defaults_to_html() {
Commands::Fetch(Box::new(FetchArgs {
dump: Some(DumpFormat::Html),
headers: vec![],
- noscript: false,
with_base: false,
with_frames: false,
trace_network: false,
@@ -497,7 +497,6 @@ fn parses_header_flag_with_explicit_fetch_command() {
name: "X-Test".to_owned(),
value: "one".to_owned(),
}],
- noscript: false,
with_base: false,
with_frames: false,
trace_network: false,
@@ -865,9 +864,8 @@ fn fetch_strip_options_combine_cli_selections() {
let cli = Cli::try_parse_from(normalize_args_for_compat([
"moli",
"fetch",
- "--noscript",
"--strip-mode",
- "ui,css",
+ "js,ui,css",
"https://example.com",
]))
.unwrap();
@@ -886,6 +884,19 @@ fn fetch_strip_options_combine_cli_selections() {
);
}
+#[test]
+fn rejects_removed_noscript_flag() {
+ let error = Cli::try_parse_from(normalize_args_for_compat([
+ "moli",
+ "fetch",
+ "--noscript",
+ "https://example.com",
+ ]))
+ .unwrap_err();
+
+ assert_eq!(error.kind(), clap::error::ErrorKind::UnknownArgument);
+}
+
#[test]
fn does_not_infer_subcommand_from_flag() {
let error =
diff --git a/skills/moli-webfetch/references/fetch-recipes.md b/skills/moli-webfetch/references/fetch-recipes.md
index 719bdcf2e..f7af4ba5e 100644
--- a/skills/moli-webfetch/references/fetch-recipes.md
+++ b/skills/moli-webfetch/references/fetch-recipes.md
@@ -79,7 +79,7 @@ moli fetch \
## Dynamic Content and Frames
-JavaScript runs by default. `--noscript` strips JavaScript from serialized
+JavaScript runs by default. `--strip-mode js` strips JavaScript from serialized
output; it does not mean that navigation ran without JavaScript.
If expected text is absent: