Created
January 20, 2022 15:52
-
-
Save typable/e81797811ba52c82883219598df8e610 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ "$1" == "new" ]]; then | |
if [[ -f ".snip" ]]; then | |
echo "Not empty dir!" | |
exit 0 | |
fi | |
cp -r /d/bin/_snip/* ./ | |
touch .snip | |
echo "Created a new snip." | |
elif [[ "$1" == "run" ]]; then | |
if [[ ! -f ".snip" ]]; then | |
echo "Not a snip!" | |
exit 0 | |
fi | |
echo "Starting snip live server..." | |
live-server --cors | |
echo "Stopped snip live server." | |
elif [[ "$1" == "edit" ]]; then | |
if [[ ! -f ".snip" ]]; then | |
echo "Not a snip!" | |
exit 0 | |
fi | |
echo "Opening snip in code editor..." | |
code . | |
elif [[ "$1" == "kill" ]]; then | |
if [[ ! -f ".snip" ]]; then | |
echo "Not a snip!" | |
exit 0 | |
fi | |
rm -r ./* | |
rm .snip | |
echo "Removed snip." | |
else | |
echo "Not a command!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment