Skip to content

Commit c604ebe

Browse files
feat(htmlsnapshot): enrich capture next-step hints and add SQL alias
- Expand capture post-snapshot tips to match the inspect command's richer format: descriptive context lines, image/link URL extraction examples, and conditional large-image filter. - Add 'as text' column alias to SQL examples in both capture and inspect tips, producing a readable output column name instead of the raw function expression. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent c7ea5eb commit c604ebe

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

cli/browser4-cli/src/main.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3260,14 +3260,21 @@ async fn handle_html_snapshot_capture(
32603260
}
32613261

32623262
// Next-step hints
3263-
cli_println!("💡 Next:");
3263+
cli_println!(" 💡 Try these next:");
3264+
cli_println!(" Use `get all text` to extract visible text, or `get all attr <name>` for attribute values.");
3265+
cli_println!(" The SQL variant lets you query with full expressive power (joins, filters, aggregates).");
32643266
if !title.is_empty() {
3265-
cli_println!(" htmlsnapshot get text \"h1\" page heading");
3267+
cli_println!(" htmlsnapshot get text \"h1\" --limit 5 # page heading");
32663268
}
3267-
cli_println!(" htmlsnapshot get all text \"a\" --limit 20 — link texts");
3268-
cli_println!(" htmlsnapshot inspect — discover recurring patterns");
3269+
cli_println!(" htmlsnapshot get all text \"a\" --limit 20 # link texts");
3270+
cli_println!(" htmlsnapshot get attr \"img[src]\" src --limit 20 # image URLs");
3271+
cli_println!(" htmlsnapshot get attr \"a[href]\" href --limit 20 # link URLs");
3272+
if image_count > 0 {
3273+
cli_println!(" htmlsnapshot get attr \"img[src]:expr(width > 200 && height > 200)\" src --limit 20 # large images only");
3274+
}
3275+
cli_println!(" htmlsnapshot inspect # discover recurring patterns");
32693276
if !url.is_empty() {
3270-
cli_println!(" htmlsnapshot query --sql \"SELECT dom_text(dom) FROM load_and_select(@url, 'h1')\"");
3277+
cli_println!(" htmlsnapshot query --sql \"SELECT dom_text(dom) as text FROM load_and_select(@url, 'a')\"");
32713278
}
32723279

32733280
Ok(())
@@ -4250,7 +4257,7 @@ async fn handle_html_snapshot_inspect(
42504257
cli_println!(" htmlsnapshot get attr \"a[href]\" href --limit 20 # link URLs");
42514258
cli_println!(" htmlsnapshot get attr \"img[src]:expr(width > 200 && height > 200)\" src --limit 20 # large images only");
42524259
if let Some(first) = actionable.first() {
4253-
cli_println!(" htmlsnapshot query --sql \"SELECT dom_text(dom) FROM load_and_select(@url, '{}')\"", first);
4260+
cli_println!(" htmlsnapshot query --sql \"SELECT dom_text(dom) as text FROM load_and_select(@url, '{}')\"", first);
42544261
}
42554262
} else {
42564263
// Fallback when no quality selectors found (e.g., all bare tags)

0 commit comments

Comments
 (0)