Skip to content

ls: print result count summary for databases and containers#129

Open
mkrueger wants to merge 1 commit into
mainfrom
dev/mkrueger/ls-verbose-counts
Open

ls: print result count summary for databases and containers#129
mkrueger wants to merge 1 commit into
mainfrom
dev/mkrueger/ls-verbose-counts

Conversation

@mkrueger

Copy link
Copy Markdown
Contributor

Summary

ls now always prints a result-count summary when listing databases and containers, matching the existing behavior for listing items.

Previously, the database and container listings printed nothing on an empty result. That made an empty scope indistinguishable from a listing that returned nothing (for example, when connected to an account whose databases are not enumerable via the SQL/Core API). Only the item listing printed a count (found N items.).

Changes

  • ListCommand.VisitConnectedStateAsync now prints command-ls-found_databases after listing databases.
  • ListCommand.ListDatabaseContainersAsync now prints command-ls-found_containers after listing containers.
  • Added two localized, plural-aware messages in lang/en.ftl:
    • command-ls-found_databasesNo databases found. / Found N database(s).
    • command-ls-found_containersNo containers found in database X. / Found N container(s) in database X.
  • Documented the summary-line behavior in docs/commands.md.

Notes

  • The count reflects the number of matched results (consistent with the item-count path), so a non-empty scope filtered down to zero will report No databases/containers found.
  • No change to JSON/MCP output contracts; this only adds a human-facing summary line.

Validation

  • dotnet build CosmosDBShell/CosmosDBShell.csproj
  • LocalizationKeyAuditTests and ListCommandTests pass (30/30).

Database and container listings previously printed nothing on an empty result, making an empty scope indistinguishable from a listing that returned nothing. ls now always prints a summary line (count or a 'No databases/containers found' message), matching the existing item-count behavior.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the ls command’s interactive output to always include a result-count summary when listing databases and containers, aligning those scopes with the existing “found N items” summary used when listing items. This improves UX by making “empty result” cases explicit instead of silently printing nothing.

Changes:

  • Print a localized, plural-aware “found databases” summary after listing databases.
  • Print a localized, plural-aware “found containers” summary after listing containers (including the database name).
  • Document the summary-line behavior in the ls command docs.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
docs/commands.md Documents that ls prints a summary line for databases/containers/items.
CosmosDBShell/lang/en.ftl Adds plural-aware localized messages for database/container result counts.
CosmosDBShell/Azure.Data.Cosmos.Shell.Commands/ListCommand.cs Emits the new summary lines after database/container listings.

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.

2 participants