lol

Merge pull request #155162 from ZenithalHourlyRate/command-not-found-interactive

command-not-found: add interactive option for auto run

authored by

Bernardo Meurer and committed by
GitHub
363ef089 ab98adb9

+11
+11
nixos/modules/programs/command-not-found/command-not-found.pl
··· 28 28 } elsif ($len == 1) { 29 29 my $package = @$res[0]->{package}; 30 30 if ($ENV{"NIX_AUTO_RUN"} // "") { 31 + if ($ENV{"NIX_AUTO_RUN_INTERACTIVE"} // "") { 32 + while (1) { 33 + print STDERR "'$program' from package '$package' will be run, confirm? [yn]: "; 34 + chomp(my $comfirm = <STDIN>); 35 + if (lc $comfirm eq "n") { 36 + exit 0; 37 + } elsif (lc $comfirm eq "y") { 38 + last; 39 + } 40 + } 41 + } 31 42 exec("nix-shell", "-p", $package, "--run", shell_quote("exec", @ARGV)); 32 43 } else { 33 44 print STDERR <<EOF;