Skip to content

implement locate and updatedb #536

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

Open
wants to merge 5 commits into
base: main
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
417 changes: 376 additions & 41 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ authors = ["uutils developers"]

[dependencies]
chrono = "0.4.40"
clap = "4.5"
clap = { version = "4.5", features = ["env"] }
faccess = "0.2.4"
walkdir = "2.5"
regex = "1.11"
onig = { version = "6.4", default-features = false }
uucore = { version = "0.0.30", features = ["entries", "fs", "fsext", "mode"] }
nix = { version = "0.29", features = ["fs", "user"] }
argmax = "0.3.1"
itertools = "0.14.0"
quick-error = "2.0.1"
uutests = "0.0.30"

[dev-dependencies]
assert_cmd = "2"
Expand All @@ -33,6 +36,14 @@ pretty_assertions = "1.4.1"
name = "find"
path = "src/find/main.rs"

[[bin]]
name = "locate"
path = "src/locate/main.rs"

[[bin]]
name = "updatedb"
path = "src/updatedb/main.rs"

[[bin]]
name = "xargs"
path = "src/xargs/main.rs"
Expand Down
1 change: 1 addition & 0 deletions src/find/matchers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ use std::{
use super::{Config, Dependencies};

pub use entry::{FileType, WalkEntry, WalkError};
pub use regex::RegexType;

/// Symlink following mode.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@
// https://opensource.org/licenses/MIT.

pub mod find;
#[cfg(unix)]
pub mod locate;
pub mod updatedb;
pub mod xargs;
17 changes: 17 additions & 0 deletions src/locate/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2017 Google Inc.
//
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

#[cfg(not(windows))]
fn main() {
let args = std::env::args().collect::<Vec<String>>();
let strs: Vec<&str> = args.iter().map(std::convert::AsRef::as_ref).collect();
std::process::exit(findutils::locate::locate_main(strs.as_slice()));
}

#[cfg(windows)]
fn main() {
println!("locate is unsupported on Windows");
}
Loading