Add --stdin flag for eval command (#348)
Adds --stdin flag to read JavaScript from stdin, enabling heredoc usage for multiline scripts without shell escaping issues.
This commit is contained in:
@@ -885,6 +885,7 @@ Executes JavaScript code in the browser context and returns the result.
|
||||
|
||||
Options:
|
||||
-b, --base64 Decode script from base64 (avoids shell escaping issues)
|
||||
--stdin Read script from stdin (useful for heredocs/multiline)
|
||||
|
||||
Global Options:
|
||||
--json Output as JSON
|
||||
@@ -895,6 +896,12 @@ Examples:
|
||||
agent-browser eval "window.location.href"
|
||||
agent-browser eval "document.querySelectorAll('a').length"
|
||||
agent-browser eval -b "ZG9jdW1lbnQudGl0bGU="
|
||||
|
||||
# Read from stdin with heredoc
|
||||
cat <<'EOF' | agent-browser eval --stdin
|
||||
const links = document.querySelectorAll('a');
|
||||
links.length;
|
||||
EOF
|
||||
"##
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user