Skip to content

Commit

Permalink
Restore accidental missing changes
Browse files Browse the repository at this point in the history
  • Loading branch information
webbedspace committed Nov 19, 2022
1 parent 9429a30 commit 120174e
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions crates/nu-command/src/filesystem/rm.rs
Expand Up @@ -199,10 +199,24 @@ fn rm(
));
}

let targets_span = Span {
start: targets
.iter()
.map(|x| x.span.start)
.min()
.expect("targets were empty"),
end: targets
.iter()
.map(|x| x.span.end)
.max()
.expect("targets were empty"),
};

let path = current_dir(engine_state, stack)?;

let (mut target_exists, mut empty_span) = (false, call.head);
let mut all_targets: HashMap<PathBuf, Span> = HashMap::new();

for target in targets {
if path.to_string_lossy() == target.item
|| path.as_os_str().to_string_lossy().starts_with(&format!(
Expand Down Expand Up @@ -277,9 +291,9 @@ fn rm(

if all_targets.is_empty() && !force {
return Err(ShellError::GenericError(
"No valid paths".into(),
"no valid paths".into(),
Some(empty_span),
"File(s) not found".into(),
"File(s) not found".into(),
Some(targets_span),
None,
Vec::new(),
));
Expand Down

0 comments on commit 120174e

Please sign in to comment.