Skip to content

feat: Add task and container flags to exec command - #50

Merged
sestrella merged 10 commits into
mainfrom
filter_tasks_and_containers
Jan 24, 2026
Merged

feat: Add task and container flags to exec command#50
sestrella merged 10 commits into
mainfrom
filter_tasks_and_containers

Conversation

@sestrella

@sestrella sestrella commented Jan 21, 2026

Copy link
Copy Markdown
Owner

No description provided.

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
sestrella marked this pull request as ready for review January 22, 2026 14:27
@sestrella
sestrella merged commit 5c8c91c into main Jan 24, 2026
2 checks passed
@sestrella
sestrella deleted the filter_tasks_and_containers branch January 24, 2026 09:03
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.

1 participant