Skip to content

Commit cbf9df9

Browse files
committed
fix(rules): attempt to resolve symlinks to avoid confusion when pulling rules
1 parent 192abcc commit cbf9df9

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎src/commands/rules.rs‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,20 @@ pub async fn handle(command: &RuleCommands, cli: &crate::Cli) -> Result<()> {
243243
written.push(path.clone());
244244
}
245245

246+
// Attempt to resolve symlinks for display
247+
let display_dir = cwd
248+
.canonicalize()
249+
.ok()
250+
.zip(out_dir.canonicalize().ok())
251+
.and_then(|(canon_cwd, canon_out)| {
252+
canon_out.strip_prefix(&canon_cwd).ok().map(|p| p.to_path_buf())
253+
})
254+
.unwrap_or(out_dir.clone());
246255
Term::stdout().write_line(&format!(
247256
"{} Wrote {} file(s) to {}",
248257
style("✓").green(),
249258
written.len(),
250-
style(out_dir.display()).bold(),
259+
style(display_dir.display()).bold(),
251260
))?;
252261
for path in &written {
253262
Term::stdout().write_line(&format!(" {path}"))?;

0 commit comments

Comments
 (0)