Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ fuzzy-select = ["fuzzy-matcher"]
history = []
password = ["zeroize"]
completion = []
folder-select = []

[dependencies]
console = "0.15.0"
Expand Down Expand Up @@ -52,6 +53,10 @@ required-features = ["history"]
name = "completion"
required-features = ["completion"]

[[example]]
name = "folder_select"
required-features = ["folder-select"]

[workspace.metadata.workspaces]
no_individual_tags = true

Expand Down
20 changes: 20 additions & 0 deletions examples/folder_select.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use dialoguer::{theme::ColorfulTheme, FolderSelect};

fn main() {
let selection = FolderSelect::with_theme(&ColorfulTheme::default())
.with_prompt("Select some sobfolder from /tmp")
.folder("/tmp")
.interact()
.unwrap();

println!("Folder you selected: {}", selection);

let selection = FolderSelect::with_theme(&ColorfulTheme::default())
.with_prompt("Select some file from /tmp")
.folder("/tmp")
.file(true)
.interact()
.unwrap();

println!("File you selected: {}", selection);
}
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ pub use prompts::{
confirm::Confirm, input::Input, multi_select::MultiSelect, select::Select, sort::Sort,
};

#[cfg(feature = "folder-select")]
pub use prompts::folder_select::FolderSelect;

#[cfg(feature = "completion")]
mod completion;
#[cfg(feature = "editor")]
Expand Down
Loading