diff options
author | Bernardo Meurer <bernardo@meurer.org> | 2022-02-08 15:30:05 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-08 15:30:05 -0800 |
commit | 363ef08971726937cd6a63de0efef7f8ba657b18 (patch) | |
tree | 9ae489fec158dd5420ec45a0fa990ff41d4a8a2d | |
parent | ab98adb9a698b47134645577608801581067ab9b (diff) | |
parent | 0358703df27cdc2526b7c17701a1da79e4e4ad5b (diff) | |
download | nixpkgs-363ef08971726937cd6a63de0efef7f8ba657b18.tar nixpkgs-363ef08971726937cd6a63de0efef7f8ba657b18.tar.gz nixpkgs-363ef08971726937cd6a63de0efef7f8ba657b18.tar.bz2 nixpkgs-363ef08971726937cd6a63de0efef7f8ba657b18.tar.lz nixpkgs-363ef08971726937cd6a63de0efef7f8ba657b18.tar.xz nixpkgs-363ef08971726937cd6a63de0efef7f8ba657b18.tar.zst nixpkgs-363ef08971726937cd6a63de0efef7f8ba657b18.zip |
Merge pull request #155162 from ZenithalHourlyRate/command-not-found-interactive
command-not-found: add interactive option for auto run
-rw-r--r-- | nixos/modules/programs/command-not-found/command-not-found.pl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/nixos/modules/programs/command-not-found/command-not-found.pl b/nixos/modules/programs/command-not-found/command-not-found.pl index 5f4b30d9019..72e246c81ae 100644 --- a/nixos/modules/programs/command-not-found/command-not-found.pl +++ b/nixos/modules/programs/command-not-found/command-not-found.pl @@ -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; |