command-not-found: add interactive option for auto run
This commit is contained in:
parent
751d92acb4
commit
0358703df2
@ -26,6 +26,17 @@ if (!defined $res || scalar @$res == 0) {
|
|||||||
} elsif (scalar @$res == 1) {
|
} elsif (scalar @$res == 1) {
|
||||||
my $package = @$res[0]->{package};
|
my $package = @$res[0]->{package};
|
||||||
if ($ENV{"NIX_AUTO_RUN"} // "") {
|
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));
|
exec("nix-shell", "-p", $package, "--run", shell_quote("exec", @ARGV));
|
||||||
} else {
|
} else {
|
||||||
print STDERR <<EOF;
|
print STDERR <<EOF;
|
||||||
|
Loading…
Reference in New Issue
Block a user