mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
61 lines
1010 B
Bash
Executable File
61 lines
1010 B
Bash
Executable File
#!/bin/bash
|
|
|
|
options=(
|
|
"auto_height_editor"
|
|
"avatar"
|
|
"button"
|
|
"checkbox"
|
|
"context_menu"
|
|
"cursor"
|
|
"disclosure"
|
|
"focus"
|
|
"icon"
|
|
"icon_button"
|
|
"keybinding"
|
|
"label"
|
|
"list"
|
|
"list_header"
|
|
"list_item"
|
|
"overflow_scroll"
|
|
"scroll"
|
|
"tab"
|
|
"tab_bar"
|
|
"text"
|
|
"viewport_units"
|
|
"z_index"
|
|
"picker"
|
|
)
|
|
|
|
run_story() {
|
|
echo "Running story: $1"
|
|
cargo run -p storybook2 -- "$1"
|
|
}
|
|
|
|
if [ "$#" -gt 0 ]; then
|
|
story_arg="$1"
|
|
# Add prefix 'components/' if not present
|
|
if [[ $story_arg != components/* ]]; then
|
|
story_arg="components/$story_arg"
|
|
fi
|
|
# Check if the provided story is a valid option
|
|
for opt in "${options[@]}"; do
|
|
if [[ "components/$opt" == "$story_arg" ]]; then
|
|
run_story "$story_arg"
|
|
exit
|
|
fi
|
|
done
|
|
echo "Invalid story name: $1"
|
|
exit 1
|
|
fi
|
|
|
|
prompt="Please select a story:"
|
|
PS3="$prompt "
|
|
select story in "${options[@]}"; do
|
|
if [[ -n $story ]]; then
|
|
run_story "components/$story"
|
|
break
|
|
else
|
|
echo "Invalid option"
|
|
fi
|
|
done
|