Created
August 11, 2023 06:20
-
-
Save naxmefy/8d067a8693be79278c0487f1343f2871 to your computer and use it in GitHub Desktop.
Simple helper for my lab projects
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
#!/usr/bin/env sh | |
# check for command - here example with nestjs | |
# shellcheck disable=SC2039 | |
if ! command -v nest &> /dev/null | |
then | |
echo "nest could not be found. install with 'npm install --global @nestjs/cli'" | |
exit | |
fi | |
MAX=$( | |
# shellcheck disable=SC2164 | |
cd samples; | |
# shellcheck disable=SC2035 | |
find * -type d -maxdepth 0 -mindepth 0 | | |
awk '/^([0-9]+)\-.+$/ { printf("%d\n", $1) }' | | |
sort -n | | |
tail -n1 | |
) | |
PROJECT_NAME=$1 | |
NEXT=$((MAX + 1)) | |
# command to create example project | |
# here example with nestjs | |
# nest new -s -g -p npm --directory "samples/$(printf "%05d\n" $NEXT)-$PROJECT_NAME" "$PROJECT_NAME" | |
# here example with flutter | |
# flutter create --org me.nax.lab --project-name "$PROJECT_NAME" "samples/$(printf "%05d\n" $NEXT)-$PROJECT_NAME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment