Skip to content

Instantly share code, notes, and snippets.

@typable
Created January 20, 2022 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save typable/e81797811ba52c82883219598df8e610 to your computer and use it in GitHub Desktop.
Save typable/e81797811ba52c82883219598df8e610 to your computer and use it in GitHub Desktop.
#!/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