mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
Merge pull request #155162 from ZenithalHourlyRate/command-not-found-interactive
command-not-found: add interactive option for auto run
This commit is contained in:
commit
363ef08971
1 changed files with 11 additions and 0 deletions
|
@ -28,6 +28,17 @@ if ($len == 0) {
|
|||
} elsif ($len == 1) {
|
||||
my $package = @$res[0]->{package};
|
||||
if ($ENV{"NIX_AUTO_RUN"} // "") {
|
||||
if ($ENV{"NIX_AUTO_RUN_INTERACTIVE"} // "") {
|
||||
while (1) {
|
||||
print STDERR "'$program' from package '$package' will be run, confirm? [yn]: ";
|
||||
chomp(my $comfirm = <STDIN>);
|
||||
if (lc $comfirm eq "n") {
|
||||
exit 0;
|
||||
} elsif (lc $comfirm eq "y") {
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
exec("nix-shell", "-p", $package, "--run", shell_quote("exec", @ARGV));
|
||||
} else {
|
||||
print STDERR <<EOF;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue