Skip to content

feat: eval --raw prints a string result as is, without JSON quotes - #909

Draft
Omarinho12345 wants to merge 1 commit into
szymdzum:mainfrom
Omarinho12345:feat/eval-raw
Draft

Omarinho12345 wants to merge 1 commit into
szymdzum:mainfrom
Omarinho12345:feat/eval-raw

Conversation

@Omarinho12345

Copy link
Copy Markdown

Closes #870.

What changed

  • bdg eval --raw (and bdg dom eval --raw) prints a string result as is: no JSON quoting, no escaping. bdg eval '"40.00"' --raw prints 40.00; a string with a newline prints over two lines.
  • Without --raw nothing changes: a string that would read as another value (the empty string, undefined, valid JSON such as "42" or "[1,2]") stays JSON-quoted.
  • Other result types (number, object, undefined) and --json output are unchanged, and --full still lifts the 20000-character cut.
  • The flag is described in --help, in the machine-readable option behaviour table, in docs/CLI_REFERENCE.md and in the bdg skill.

Scripts that read a value today get "40.00" and have to strip the quotes; --raw returns the value itself.

Verification

  • npx tsx --test src/ui/formatters/__tests__/dom.unit.test.ts src/commands/__tests__/optionBehaviors.unit.test.ts — 32 passed. New cases cover 40.00, 42, undefined, the empty string, multi-line text and JSON-looking strings with --raw; unchanged output without it; and the character cap still applying without --full.
  • npm run type-check and npm run lint (0 errors) pass; touched files are Prettier-clean.

@szymdzum

Copy link
Copy Markdown
Owner

Thanks a lot for this, really nice first contribution! 🙌

I checked it out locally: build, tests and lint pass, and bdg eval --raw does exactly what #870 asked for against a live Chrome (40.00, multi-line strings, "", JSON-looking strings, other types and --json unchanged). Docs, option behaviors and the skill are all covered too.

Once CI is green, mark it ready for review and I'll merge it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

eval --raw: print a string result as plain text (scripts strip JSON quotes today)

2 participants