-
-
Notifications
You must be signed in to change notification settings - Fork 13.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
command-not-found: suggest nix-shell as well #74993
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
use Config; | ||
|
||
my $program = $ARGV[0]; | ||
my $quoted_command = '"' . shell_quote(@ARGV) . '"'; | ||
|
||
my $dbPath = "@dbPath@"; | ||
|
||
|
@@ -38,6 +39,9 @@ | |
print STDERR <<EOF; | ||
The program ‘$program’ is currently not installed. You can install it by typing: | ||
nix-env -iA nixos.$package | ||
|
||
Or run it once with: | ||
nix-shell -p $package --run $quoted_command | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, I've seen that change. That's really backwards. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I agree. But we shouldn't recommend it until that problem is solved. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is putting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
EOF | ||
} | ||
} else { | ||
|
@@ -46,6 +50,8 @@ | |
several packages. You can install it by typing one of the following: | ||
EOF | ||
print STDERR " nix-env -iA nixos.$_->{package}\n" foreach @$res; | ||
print STDERR "\nOr run it once with:\n"; | ||
print STDERR " nix-shell -p $_->{package} --run $quoted_command\n" foreach @$res; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here |
||
} | ||
|
||
exit 127; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this guaranteed to be correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likely not - but for corner cases what is 'correct' might be different depending on what shell the user is using, and taking that into account seems excessive.