mirror of
https://github.com/NixOS/nix
synced 2025-07-07 06:01:48 +02:00
Merge pull request #4803 from ShamrockLee/nix-channel-list-generations
Add `nix-channel --list-generations`
This commit is contained in:
commit
ff905cb796
4 changed files with 21 additions and 1 deletions
|
@ -177,6 +177,7 @@ static int main_nix_channel(int argc, char ** argv)
|
|||
cRemove,
|
||||
cList,
|
||||
cUpdate,
|
||||
cListGenerations,
|
||||
cRollback
|
||||
} cmd = cNone;
|
||||
std::vector<std::string> args;
|
||||
|
@ -193,6 +194,8 @@ static int main_nix_channel(int argc, char ** argv)
|
|||
cmd = cList;
|
||||
} else if (*arg == "--update") {
|
||||
cmd = cUpdate;
|
||||
} else if (*arg == "--list-generations") {
|
||||
cmd = cListGenerations;
|
||||
} else if (*arg == "--rollback") {
|
||||
cmd = cRollback;
|
||||
} else {
|
||||
|
@ -237,6 +240,11 @@ static int main_nix_channel(int argc, char ** argv)
|
|||
case cUpdate:
|
||||
update(StringSet(args.begin(), args.end()));
|
||||
break;
|
||||
case cListGenerations:
|
||||
if (!args.empty())
|
||||
throw UsageError("'--list-generations' expects no arguments");
|
||||
std::cout << runProgram(settings.nixBinDir + "/nix-env", false, {"--profile", profile, "--list-generations"}) << std::flush;
|
||||
break;
|
||||
case cRollback:
|
||||
if (args.size() > 1)
|
||||
throw UsageError("'--rollback' has at most one argument");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue