diff options
Diffstat (limited to 'src/dotup.rs')
| -rw-r--r-- | src/dotup.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/dotup.rs b/src/dotup.rs index a7cccbe..296b182 100644 --- a/src/dotup.rs +++ b/src/dotup.rs | |||
| @@ -287,11 +287,18 @@ impl Dotup { | |||
| 287 | Ok(()) | 287 | Ok(()) |
| 288 | } | 288 | } |
| 289 | 289 | ||
| 290 | pub fn status(&self) { | 290 | pub fn status(&self, paths: impl Iterator<Item = impl AsRef<Path>>) { |
| 291 | let status_result: anyhow::Result<()> = try { | 291 | let status_result: anyhow::Result<()> = try { |
| 292 | let canonical_dir = utils::current_working_directory(); | 292 | // canonicalize and remove paths whose parent we already have |
| 293 | let item = self.status_path_to_item(&canonical_dir)?; | 293 | let paths = paths.map(utils::weakly_canonical).collect::<HashSet<_>>(); |
| 294 | self.status_print_item(item, 0)?; | 294 | let paths = paths |
| 295 | .iter() | ||
| 296 | .filter(|p| !paths.iter().any(|x| p.starts_with(x) && p != &x)); | ||
| 297 | |||
| 298 | for path in paths { | ||
| 299 | let item = self.status_path_to_item(path)?; | ||
| 300 | self.status_print_item(item, 0)?; | ||
| 301 | } | ||
| 295 | }; | 302 | }; |
| 296 | if let Err(e) = status_result { | 303 | if let Err(e) = status_result { |
| 297 | println!("error while displaying status : {e}"); | 304 | println!("error while displaying status : {e}"); |
