#prompt #user #file #pick #interactively #directory #label

file_picker

Prompts the user to pick a file interactively from the current directory

8 unstable releases (3 breaking)

0.4.0 Jan 2, 2025
0.3.4 Nov 28, 2024
0.2.2 Nov 20, 2024
0.1.0 Nov 15, 2024

#931 in Rust patterns

Download history 381/week @ 2024-11-14 200/week @ 2024-11-21 172/week @ 2024-11-28 5/week @ 2024-12-05 4/week @ 2024-12-12 145/week @ 2025-01-02 3/week @ 2025-01-09

148 downloads per month

MIT/Apache

75KB
2.5K SLoC

Prompts the user to pick a file interactively from the current directory.

Arguments

  • label - A string slice that holds the prompt label to display to the user.

Returns

  • std::io::Result<PathBuf> - Returns the PathBuf of the selected file.

Examples

fn main() -> std::io::Result<()> {
    let file_path = file_picker::file_picker("Select a file:")?;
    println!("You selected the file: {}", file_path.display());

    let dir_path = file_picker::dir_picker("Select a directory:")?;
    println!("You selected the directory: {}", dir_path.display());
}

Dependencies

~3–10MB
~99K SLoC