Skip to content

armgit / moli

Public Imported from GitHub
0

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

feat(cli): add dcl wait alias

ldm0494ed8356ad2
diff --git a/moli/src/cli.rs b/moli/src/cli.rs
index 880bd9ffc..92a852aa7 100644
--- a/moli/src/cli.rs
+++ b/moli/src/cli.rs
@@ -476,6 +476,7 @@ pub enum StripModeChoice {
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
#[value(rename_all = "lower")]
pub enum FetchWaitUntil {
+ #[value(alias = "dcl")]
DomContentLoaded,
Load,
NetworkIdle,
diff --git a/moli/tests/cli.rs b/moli/tests/cli.rs
index 994ff5153..941a14dfd 100644
--- a/moli/tests/cli.rs
+++ b/moli/tests/cli.rs
@@ -826,6 +826,26 @@ fn parses_fetch_wait_until_and_timeout() {
assert_eq!(args.timeout, 1500);
}
+#[test]
+fn parses_dcl_fetch_wait_until_alias() {
+ for value in ["domcontentloaded", "dcl"] {
+ let cli = Cli::try_parse_from(normalize_args_for_compat([
+ "moli",
+ "fetch",
+ "--wait-until",
+ value,
+ "https://example.com",
+ ]))
+ .unwrap();
+
+ let Commands::Fetch(args) = cli.command else {
+ panic!("expected fetch command");
+ };
+
+ assert_eq!(args.wait_until, FetchWaitUntil::DomContentLoaded);
+ }
+}
+
#[test]
fn parses_fetch_response_wait_flags() {
let cli = Cli::try_parse_from(normalize_args_for_compat([