mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-09-11 07:05:38 +03:00
Add a warning for overwriting the example
This commit is contained in:
parent
f69b7e7909
commit
dcf1956944
@ -10,6 +10,29 @@ read -p "What is the name of the new component? " example_name
|
||||
|
||||
echo ""
|
||||
|
||||
path=component-catalog/src/Examples/"${example_name}.elm"
|
||||
|
||||
if test -f "${path}"; then
|
||||
echo "${path} exists."
|
||||
echo ""
|
||||
read -p "Do you want to overwrite the existing ${example_name} example? (y/n) " overwrite
|
||||
|
||||
while true; do
|
||||
case $overwrite in
|
||||
[yY] )
|
||||
echo ""
|
||||
echo "Okay, we'll proceed and plan to overwrite ${path}."
|
||||
echo ""
|
||||
break;;
|
||||
[nN] )
|
||||
echo ""
|
||||
echo "Okay, not overwriting the example. Exiting, bye 👋"
|
||||
exit;;
|
||||
* ) echo "Please enter Y, y, N, or n to proceed.";;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
while true; do
|
||||
read -p "Is this component a collection of icons? (y/n) " yn
|
||||
case $yn in
|
||||
@ -44,7 +67,7 @@ done
|
||||
echo ""
|
||||
echo "Creating \`Examples.${example_name}\` for you in the component-catalog folder."
|
||||
|
||||
path=component-catalog/src/Examples/"${example_name}.elm"
|
||||
|
||||
printf "${template}" >| "${path}"
|
||||
|
||||
echo ""
|
||||
@ -52,6 +75,7 @@ echo "Created ${path}."
|
||||
|
||||
echo ""
|
||||
echo "Regenerating \`Examples.elm\` so it inclues \`Examples.${example_name}\`."
|
||||
echo ""
|
||||
|
||||
. ./script/regenerate-examples.sh
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user