diff --git a/README.md b/README.md index fe10225..66bb127 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ To view a list of commands through the CLI you can use `azlazy --help`, each com | Command | Description | |--------------|:-------------| | `azlazy addqueue --name "queue to add"` | Creates a new queue with the given name | -| `azlazy queue --list` | View a list of queues in the storage account along with the number of messages they are holding, poison queues are highlighted in red | +| `azlazy queue --list` | View a list of queues in the storage account along with the number of messages they are holding, poison queues are highlighted in red. You can also filter the list with `--contains` | | `azlazy queue --remove "queue to remove"` | Removes the queue with the given name | | `azlazy queue --cure "queue to move poison messages to"` | Moves poison queue messages back into the processing queue | | `azlazy queue --clear "queue to clear"` | Removes all messages in the queue | @@ -85,7 +85,7 @@ To view a list of commands through the CLI you can use `azlazy --help`, each com | Command | Description | |--------------|:-------------| -| `azlazy container --list` | View a list of containers in the storage account, along with whether or not its public and when it was last modified | +| `azlazy container --list` | View a list of containers in the storage account, along with whether or not its public and when it was last modified. You can also filter the list with `--contains` | More coming soon ! @@ -111,3 +111,4 @@ I haven't written any contributing guidelines yet but you can reach me here on [ | 01/11/2020 | v1.1.0 | Added command to move messages from one queue to another | | 04/11/2020 | v1.1.1 | Added a fix for printing out multiline JSON | | 06/11/2020 | v1.1.2 | Added command to list containers | +| 06/11/2020 | v1.1.3 | Added a contains filter when listing queues and containers | \ No newline at end of file diff --git a/az-lazy/Commands/Container/ContainerOptions.cs b/az-lazy/Commands/Container/ContainerOptions.cs index 4e77d5b..0c38fe0 100644 --- a/az-lazy/Commands/Container/ContainerOptions.cs +++ b/az-lazy/Commands/Container/ContainerOptions.cs @@ -7,5 +7,8 @@ public class ContainerOptions : ICommandOptions { [Option('l', "list", Required = false, HelpText = "List all containers available")] public bool List { get; set; } + + [Option("contains", Required = false, HelpText = "Use in combination with list, allows you to filter the list returned")] + public string Contains { get; set; } } } \ No newline at end of file diff --git a/az-lazy/Commands/Container/Executor/ListBlobExecutor.cs b/az-lazy/Commands/Container/Executor/ListBlobExecutor.cs index a502e29..8f84747 100644 --- a/az-lazy/Commands/Container/Executor/ListBlobExecutor.cs +++ b/az-lazy/Commands/Container/Executor/ListBlobExecutor.cs @@ -38,6 +38,11 @@ public async Task Execute(ContainerOptions opts) ConsoleHelper.WriteSepparator(); } + if(!string.IsNullOrEmpty(opts.Contains)) + { + containers = containers.Where(x => x.Name.Contains(opts.Contains)).ToList(); + } + foreach (var container in containers) { var isPublic = container.Properties.PublicAccess.HasValue ? "(public)" : "(private)"; diff --git a/az-lazy/Commands/Queue/Executor/ListExecutor.cs b/az-lazy/Commands/Queue/Executor/ListExecutor.cs index 84e6bdd..9811234 100644 --- a/az-lazy/Commands/Queue/Executor/ListExecutor.cs +++ b/az-lazy/Commands/Queue/Executor/ListExecutor.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Threading.Tasks; using az_lazy.Helpers; using az_lazy.Manager; @@ -34,6 +35,11 @@ public async Task Execute(QueueOptions opts) ConsoleHelper.WriteLineSuccessWaiting(message); ConsoleHelper.WriteSepparator(); + if(!string.IsNullOrEmpty(opts.Contains)) + { + queueList = queueList.Where(x => x.Name.Contains(opts.Contains)).ToList(); + } + foreach (var queue in queueList) { await queue.FetchAttributesAsync().ConfigureAwait(false); diff --git a/az-lazy/Commands/Queue/QueueOptions.cs b/az-lazy/Commands/Queue/QueueOptions.cs index 2d34afa..6f27f7a 100644 --- a/az-lazy/Commands/Queue/QueueOptions.cs +++ b/az-lazy/Commands/Queue/QueueOptions.cs @@ -8,6 +8,9 @@ public class QueueOptions : ICommandOptions [Option('l', "list", Required = false, HelpText = "List all connections available")] public bool List { get; set; } + [Option("contains", Required = false, HelpText = "Use in combination with list, allows you to filter the list returned")] + public string Contains { get; set; } + [Option('r', "remove", Required = false, HelpText = "Queue name to remove")] public string RemoveQueue { get; set; } diff --git a/az-lazy/az-lazy.csproj b/az-lazy/az-lazy.csproj index 632fc05..2f8b041 100644 --- a/az-lazy/az-lazy.csproj +++ b/az-lazy/az-lazy.csproj @@ -6,7 +6,7 @@ true azlazy ./nupkg - 1.1.2 + 1.1.3 azlazy Faesel Saeed Faesel Saeed diff --git a/documentation/contributing.md b/documentation/contributing.md index 31e1cb1..e785dda 100644 --- a/documentation/contributing.md +++ b/documentation/contributing.md @@ -43,3 +43,6 @@ https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azurite?toc=/a https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-containers-list?tabs=dotnet +Change table to CsConsoleFormat as it supports word wrap + +https://stackoverflow.com/questions/856845/how-to-best-way-to-draw-table-in-console-app-c