diff --git a/CosmosDBShell/Azure.Data.Cosmos.Shell.Commands/ListCommand.cs b/CosmosDBShell/Azure.Data.Cosmos.Shell.Commands/ListCommand.cs index 4372aa8..7c3d900 100644 --- a/CosmosDBShell/Azure.Data.Cosmos.Shell.Commands/ListCommand.cs +++ b/CosmosDBShell/Azure.Data.Cosmos.Shell.Commands/ListCommand.cs @@ -92,6 +92,12 @@ async Task IStateVisitor.VisitConn CosmosCompleteCommand.SetDatabases(state.Client, completionList); + AnsiConsole.MarkupLine(MessageService.GetString("command-ls-found_databases", new Dictionary + { + { "count", list.Count }, + { "display", Theme.FormatTableValue(list.Count.ToString()) }, + })); + var result = new CommandState { IsPrinted = true, @@ -136,6 +142,13 @@ private async Task ListDatabaseContainersAsync(ConnectedState stat CosmosCompleteCommand.SetContainers(state.Client, databaseName, completionList); + AnsiConsole.MarkupLine(MessageService.GetString("command-ls-found_containers", new Dictionary + { + { "count", list.Count }, + { "display", Theme.FormatTableValue(list.Count.ToString()) }, + { "database", Theme.DatabaseNamePromt(databaseName) }, + })); + var result = new CommandState { IsPrinted = true, diff --git a/CosmosDBShell/lang/en.ftl b/CosmosDBShell/lang/en.ftl index f1bc7e5..a67ee4f 100644 --- a/CosmosDBShell/lang/en.ftl +++ b/CosmosDBShell/lang/en.ftl @@ -346,6 +346,18 @@ command-ls-description-container = The container to list items from command-ls-description-key = The property to match against (default: container partition key property) command-ls-container = Container { $container } command-ls-found_items = found { $count } items. +command-ls-found_databases = + { $count -> + [0] No databases found. + [one] Found { $display } database. + *[other] Found { $display } databases. + } +command-ls-found_containers = + { $count -> + [0] No containers found in database { $database }. + [one] Found { $display } container in database { $database }. + *[other] Found { $display } containers in database { $database }. + } command-ls-error-request_failed = List request failed with status code { $statusCode } ({ $status }). command-ls-error-no_content_stream = The list request completed, but Cosmos DB returned no response body. This is not an empty-container result; retry the command and use --verbose if it keeps happening. command-ls-error-empty_content = The list request completed, but Cosmos DB returned an empty response body. This is not an empty-container result; retry the command and use --verbose if it keeps happening. diff --git a/docs/commands.md b/docs/commands.md index 1ea5dca..a35c771 100644 --- a/docs/commands.md +++ b/docs/commands.md @@ -58,6 +58,8 @@ Options: When `ls` is listing items from a container, it defaults to `100` items if `--max` is not specified. If the limit is hit at runtime, the shell prints a message telling you the results were limited. Use `--max ` to choose another limit or `--max 0` or a negative value to disable the limit. +`ls` always prints a summary line for how many results it found. When listing databases it reports the database count (or `No databases found.`), when listing containers it reports the container count for the database (or `No containers found in database ...`), and when listing items it reports the item count. The summary makes it clear when a scope is genuinely empty versus when the listing simply returned nothing. + ### cd Change scope to database or container.