Skip to content
Myr

[ownership] add --owner arg parsing and storage

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Alexandru Macovei · committed by David Peter · parent 30cb4ad · Browse files · 3 files+26 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+26 added−0 removed

  • other:+26 added−0 removed

3 files+26 added−0 removed

modified:src/app.rs+9 added
522 unmodified lines
523 --search-path <path2> [<pattern>]`",524 ),525 );526527 if cfg!(unix) {528 app = app.arg(529 Arg::with_name("owner")530 .long("owner")531 .short("o")532 .takes_value(true),533 );534 }535536 // Make `--one-file-system` available only on Unix and Windows platforms, as per the537 // restrictions on the corresponding option in the `ignore` crate.538 // Provide aliases `mount` and `xdev` for people coming from `find`.539 if cfg!(any(unix, windows)) {
16 unmodified lines
modified:src/main.rs+11 added
23 unmodified lines
2425use crate::exec::CommandTemplate;26use crate::exit_codes::ExitCode;27use crate::filetypes::FileTypes;28#[cfg(unix)]29use crate::filter::OwnerFilter;30use crate::filter::{SizeFilter, TimeFilter};31use crate::options::Options;32use crate::regex_helper::pattern_has_uppercase_char;33
242 unmodified lines
276 ));277 }278 }279280 #[cfg(unix)]281 let owner_constraint = if let Some(s) = matches.value_of("owner") {282 Some(OwnerFilter::from_string(s)?)283 } else {284 None285 };286287 let config = Options {288 case_sensitive,289 search_full_path: matches.is_present("full-path"),290 ignore_hidden: !(matches.is_present("hidden")
75 unmodified lines
366 .map(|vs| vs.map(PathBuf::from).collect())367 .unwrap_or_else(|| vec![]),368 size_constraints: size_limits,369 time_constraints,370 #[cfg(unix)]371 owner_constraint,372 show_filesystem_errors: matches.is_present("show-errors"),373 path_separator,374 max_results: matches375 .value_of("max-results")
39 unmodified lines
modified:src/options.rs+6 added
3 unmodified lines
4use regex::bytes::RegexSet;56use crate::exec::CommandTemplate;7use crate::filetypes::FileTypes;8#[cfg(unix)]9use crate::filter::OwnerFilter;10use crate::filter::{SizeFilter, TimeFilter};1112/// Configuration options for *fd*.13pub struct Options {
69 unmodified lines
8384 /// Constraints on last modification time of files85 pub time_constraints: Vec<TimeFilter>,8687 #[cfg(unix)]88 /// User/group ownership constraint89 pub owner_constraint: Option<OwnerFilter>,9091 /// Whether or not to display filesystem errors92 pub show_filesystem_errors: bool,9394 /// The separator used to print file paths.
5 unmodified lines