Skip to content

feat(output): replace home directory with ~ in printed paths#1730

Closed
n0ta26 wants to merge 2 commits intosharkdp:masterfrom
n0ta26:feature/replace-home-dir-tilde
Closed

feat(output): replace home directory with ~ in printed paths#1730
n0ta26 wants to merge 2 commits intosharkdp:masterfrom
n0ta26:feature/replace-home-dir-tilde

Conversation

@n0ta26
Copy link
Copy Markdown

@n0ta26 n0ta26 commented May 29, 2025

Summary

This pull request adds support for replacing the absolute home directory path
with ~ in printed file paths, as suggested in issue #1688.

Details

  • Modified print_entry_uncolorized_base, print_entry_colorized, and other output functions to use replace_home_dir.
  • Ensured that this replacement works with --color=always, --color=never, and path separator options.
  • Added an integration test to confirm that paths under $HOME are displayed with ~.

Related Issue

Fixes #1688

n0ta26 added 2 commits May 30, 2025 00:40
This change replaces the absolute home directory path with `~` when printing
file paths to the output, making the output more readable and concise.

Fixes sharkdp#1688
@n0ta26 n0ta26 closed this Oct 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support ~ in results (for --color)

1 participant