Skip to content

Add --count to print the number of records in a response#287

Open
jongio wants to merge 1 commit into
mainfrom
idea/count
Open

Add --count to print the number of records in a response#287
jongio wants to merge 1 commit into
mainfrom
idea/count

Conversation

@jongio

@jongio jongio commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Implements #282.

Adds a --count flag that prints how many records a response contains as a single integer, so you can pipe the result straight into scripts without a jq dependency.

Behavior

  • Array body: prints the element count.
  • ARM list body (object with a value[] array): prints the length of value.
  • Single object: prints 1.
  • null: prints 0.
  • Runs after --query, so you can count a projected slice.
  • Non-JSON responses report a clear error instead of guessing.

Test

go test ./src/internal/service/... -run Count covers each body shape, the runs-after-query path, and the non-JSON error.

Adds a --count boolean flag that prints a single integer: the array
length, the length of an ARM value[] array, 1 for a single object,
and 0 for null. It runs after --query so you can count a projected
slice, and reports a clear error for non-JSON responses.

Closes #282

Co-authored-by: Copilot App <[email protected]>
@jongio jongio added the idea Feature idea from the idea pipeline label Jul 13, 2026
@jongio jongio self-assigned this Jul 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Website Preview

Your PR preview is ready!

📎 Preview URL: https://jongio.github.io/azd-rest/pr/287/

This preview will be automatically cleaned up when the PR is closed.

github-actions Bot added a commit that referenced this pull request Jul 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Test This PR

A preview build (0.5.0-pr287) is ready for testing!

One-Line Install (Recommended)

PowerShell (Windows):

iex "& { $(irm https://raw.githubusercontent.com/jongio/azd-rest/main/scripts/install-pr.ps1) } -PrNumber 287 -Version 0.5.0-pr287"

Bash (macOS/Linux):

curl -fsSL https://raw.githubusercontent.com/jongio/azd-rest/main/scripts/install-pr.sh | bash -s 287 0.5.0-pr287

Uninstall

PowerShell (Windows):

iex "& { $(irm https://raw.githubusercontent.com/jongio/azd-rest/main/scripts/uninstall-pr.ps1) } -PrNumber 287"

Bash (macOS/Linux):

curl -fsSL https://raw.githubusercontent.com/jongio/azd-rest/main/scripts/uninstall-pr.sh | bash -s 287

Build Info:

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

Labels

idea Feature idea from the idea pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant