Skip to content

Instantly share code, notes, and snippets.

@Senorsen
Last active July 11, 2016 09:18
Show Gist options
  • Save Senorsen/55c8326b7ecf94d4b7f105f118f2f9c0 to your computer and use it in GitHub Desktop.
Save Senorsen/55c8326b7ecf94d4b7f105f118f2f9c0 to your computer and use it in GitHub Desktop.
# for generate import
for f in *.ts; do MODEL_NAME=$(grep -ohw 'class \(\w\+Model\)' $f | grep -ohw '\w\+Model'); test $MODEL_NAME && echo "import ${MODEL_NAME} from './$(echo $f | sed 's/\.ts$//')';"; done
# for generate Interface
for f in *.ts; do MODEL_NAME=$(grep -ohw 'class \(\w\+Model\)' $f | grep -ohw '\w\+Model'); test $MODEL_NAME && echo "$(echo ${MODEL_NAME} | sed -e 's/\w/\L\0/' | sed -e 's/Model$//'): ${MODEL_NAME};"; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment