mirror of
https://github.com/sharkdp/fd.git
synced 2026-10-12 02:22:28 +00:00
refactor: Rename cwd as full_path_base
Because I think it makes it's intention more clear.
This commit is contained in:
+1
-1
@@ -17,7 +17,7 @@ pub struct Config {
|
||||
|
||||
/// Cached current working directory for absolute path construction.
|
||||
/// Populated when `--full-path` is set; `None` means search by filename only.
|
||||
pub cwd: Option<PathBuf>,
|
||||
pub full_path_base: Option<PathBuf>,
|
||||
|
||||
/// Whether to ignore hidden files and directories (or not).
|
||||
pub ignore_hidden: bool,
|
||||
|
||||
+2
-2
@@ -245,7 +245,7 @@ fn construct_config(mut opts: Opts, pattern_regexps: &[String]) -> Result<Config
|
||||
let command = extract_command(&mut opts, colored_output)?;
|
||||
let has_command = command.is_some();
|
||||
|
||||
let cwd = if opts.full_path {
|
||||
let full_path_base = if opts.full_path {
|
||||
Some(env::current_dir().context(
|
||||
"Could not determine current directory. \
|
||||
This is required for --full-path.",
|
||||
@@ -256,7 +256,7 @@ fn construct_config(mut opts: Opts, pattern_regexps: &[String]) -> Result<Config
|
||||
|
||||
Ok(Config {
|
||||
case_sensitive,
|
||||
cwd,
|
||||
full_path_base,
|
||||
ignore_hidden: !(opts.hidden || opts.rg_alias_ignore()),
|
||||
read_fdignore: !(opts.no_ignore || opts.rg_alias_ignore()),
|
||||
read_vcsignore: !(opts.no_ignore || opts.rg_alias_ignore() || opts.no_ignore_vcs),
|
||||
|
||||
+1
-1
@@ -524,7 +524,7 @@ impl WorkerState {
|
||||
// Check the name first, since it doesn't require metadata
|
||||
let entry_path = entry.path();
|
||||
|
||||
let search_str = search_str_for_entry(entry_path, config.cwd.as_deref());
|
||||
let search_str = search_str_for_entry(entry_path, config.full_path_base.as_deref());
|
||||
|
||||
if !patterns
|
||||
.iter()
|
||||
|
||||
Reference in New Issue
Block a user