Skip to content

Commit 01a2423

Browse files
Merge pull request #243 from Ma27/top-level-default
Make `--top-level` the default behavior of `nix-locate`
2 parents 4b80066 + 66cd679 commit 01a2423

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
### Fixed
44
### Changed
55

6+
* `--top-level` is now the default. To use the old default, add `--all`.
7+
68
## 0.1.8
79
### Added
810

command-not-found.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ command_not_found_handle () {
1616

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

2222
case $len in

src/bin/nix-locate.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ fn process_args(matches: Opts) -> result::Result<Args, clap::Error> {
187187
file_type: matches
188188
.r#type
189189
.unwrap_or_else(|| files::ALL_FILE_TYPES.to_vec()),
190-
only_toplevel: matches.top_level,
190+
only_toplevel: !matches.all,
191191
color,
192192
minimal: matches.minimal,
193193
};
@@ -255,9 +255,9 @@ struct Opts {
255255
#[clap(long, name = "HASH")]
256256
hash: Option<String>,
257257

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

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

0 commit comments

Comments
 (0)