Skip to main content

format_filename

Function format_filename 

Source
pub fn format_filename(path: &Path) -> String
Expand description

Format a path for user-friendly display.

This function shortens paths by replacing the home directory with ~ and using forward slashes on all platforms.

ยงExample

use click::utils::format_filename;
use std::path::Path;

let path = Path::new("/home/user/documents/file.txt");
let formatted = format_filename(path);
// May return "~/documents/file.txt" if /home/user is the home directory