Skip to content
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

Make --top-level the default behavior of nix-locate #243

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
### Fixed
### Changed

* `--top-level` is now the default. To use the old default, add `--all`.

## 0.1.8
### Added

Expand Down
2 changes: 1 addition & 1 deletion command-not-found.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ command_not_found_handle () {

toplevel=nixpkgs # nixpkgs should always be available even in NixOS
cmd=$1
attrs=$(@out@/bin/nix-locate --minimal --no-group --type x --type s --top-level --whole-name --at-root "/bin/$cmd")
attrs=$(@out@/bin/nix-locate --minimal --no-group --type x --type s --whole-name --at-root "/bin/$cmd")
len=$(echo -n "$attrs" | grep -c "^")

case $len in
Expand Down
6 changes: 3 additions & 3 deletions src/bin/nix-locate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ fn process_args(matches: Opts) -> result::Result<Args, clap::Error> {
file_type: matches
.r#type
.unwrap_or_else(|| files::ALL_FILE_TYPES.to_vec()),
only_toplevel: matches.top_level,
only_toplevel: !matches.all,
color,
minimal: matches.minimal,
};
Expand Down Expand Up @@ -255,9 +255,9 @@ struct Opts {
#[clap(long, name = "HASH")]
hash: Option<String>,

/// Only print matches from packages that show up in `nix-env -qa`.
/// Print all matches, not only print from packages that show up in `nix-env -qa`.
#[clap(long)]
top_level: bool,
all: bool,

/// Only print matches for files that have this type. If the option is given multiple times,
/// a file will be printed if it has any of the given types.
Expand Down
Loading