Prevent storybook dialog from swallowing terminal cursor when ctrl-c-ed
This commit is contained in:
parent
fc294ce0b1
commit
5000a53a61
3 changed files with 98 additions and 3 deletions
|
@ -44,11 +44,17 @@ fn main() {
|
|||
let story_selector = args.story.clone().unwrap_or_else(|| {
|
||||
let stories = ComponentStory::iter().collect::<Vec<_>>();
|
||||
|
||||
let selection = FuzzySelect::new()
|
||||
ctrlc::set_handler(move || {}).unwrap();
|
||||
|
||||
let result = FuzzySelect::new()
|
||||
.with_prompt("Choose a story to run:")
|
||||
.items(&stories)
|
||||
.interact()
|
||||
.unwrap();
|
||||
.interact();
|
||||
|
||||
let Ok(selection) = result else {
|
||||
dialoguer::console::Term::stderr().show_cursor().unwrap();
|
||||
std::process::exit(0);
|
||||
};
|
||||
|
||||
StorySelector::Component(stories[selection])
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue