Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CosmosDBShell/Azure.Data.Cosmos.Shell.Commands/ListCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@ async Task<CommandState> IStateVisitor<CommandState, ShellInterpreter>.VisitConn

CosmosCompleteCommand.SetDatabases(state.Client, completionList);

AnsiConsole.MarkupLine(MessageService.GetString("command-ls-found_databases", new Dictionary<string, object>
{
{ "count", list.Count },
{ "display", Theme.FormatTableValue(list.Count.ToString()) },
}));

var result = new CommandState
{
IsPrinted = true,
Expand Down Expand Up @@ -136,6 +142,13 @@ private async Task<CommandState> ListDatabaseContainersAsync(ConnectedState stat

CosmosCompleteCommand.SetContainers(state.Client, databaseName, completionList);

AnsiConsole.MarkupLine(MessageService.GetString("command-ls-found_containers", new Dictionary<string, object>
{
{ "count", list.Count },
{ "display", Theme.FormatTableValue(list.Count.ToString()) },
{ "database", Theme.DatabaseNamePromt(databaseName) },
}));

var result = new CommandState
{
IsPrinted = true,
Expand Down
12 changes: 12 additions & 0 deletions CosmosDBShell/lang/en.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <n>` 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.
Expand Down
Loading