1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 22:33:57 +02:00

profile: add --regex option to match packages

This commit is contained in:
Bob van der Linden 2024-03-07 20:33:59 +01:00
parent d6f5da51d3
commit 87741dbd21
No known key found for this signature in database
4 changed files with 21 additions and 3 deletions

View file

@ -11,7 +11,7 @@ R""(
* Remove all packages:
```console
# nix profile remove '.*'
# nix profile remove --regex '.*'
```
* Remove a package by store path:

View file

@ -6,7 +6,7 @@ R""(
reference:
```console
# nix profile upgrade '.*'
# nix profile upgrade --regex '.*'
```
* Upgrade a specific package by name:

View file

@ -508,7 +508,15 @@ public:
MixProfileElementMatchers()
{
expectArgs(ExpectedArg {
addFlag({
.longName = "regex",
.description = "A regular expression to match one or more packages in the profile.",
.labels = {"pattern"},
.handler = {[this](std::string arg) {
_matchers.push_back(createRegexMatcher(arg));
}},
});
expectArgs({
.label = "elements",
.optional = true,
.handler = {[this](std::vector<std::string> args) {