feat: Add task and container flags to exec command - #50
Merged
Conversation
Introduce `--task` and `--container` flags to the `exec` command, enabling users to filter tasks and containers by a regex pattern during interactive selection. * Update `execSelector` to pass these patterns to the `selector.Selectors` methods. * Refactor `root.go` to move persistent flag processing into `PreRunE` and use `regexp.Compile` with error handling for all regex patterns (cluster, service, task, container). * Add `selector/mocks_test.go` and `selector/root_test.go` to provide unit tests for the regex filtering logic. * Improve the error message when no resources match a given filter. * Add `foo/` to `.gitignore`.
This commit refactors the flag parsing logic in the `rootCmd` and `execCmd` to improve clarity and error handling. Previously, the `clusterRegex` and `serviceRegex` were declared as global variables and assigned directly. This commit introduces local `regex` variables within the flag parsing functions, compiles the regex, and then assigns it to the global variables. This change enhances readability and allows for more specific error handling during the compilation process. Additionally, empty lines were added after flag processing blocks in `execCmd` for better code organization.
The flags for the exec command were previously retrieved directly from the command object within the RunE function. This commit changes the implementation to bind the flags to local variables (`execCommand` and `execInteractive`) during initialization. This simplifies the RunE function and makes the flag handling more explicit.
Adds a new `test` directory to the build inputs for the Go application. This likely prepares the project for including unit or integration tests.
sestrella
marked this pull request as ready for review
January 22, 2026 14:27
Configure the `go` language to use `golines` as its formatter.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.