Skip to content

Instantly share code, notes, and snippets.

@naxmefy
Created August 11, 2023 06:20
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 naxmefy/8d067a8693be79278c0487f1343f2871 to your computer and use it in GitHub Desktop.
Save naxmefy/8d067a8693be79278c0487f1343f2871 to your computer and use it in GitHub Desktop.
Simple helper for my lab projects
#!/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