Created
December 27, 2019 15:14
-
-
Save bikallem/906ca4cb3b2749b7ca0a7acb0a580681 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 bash | |
| set -e | |
| # Converts .ml to .re | |
| ls -A *ml* | while read file; do | |
| if [[ "$file" =~ (\.ml|\.mli)$ ]]; then | |
| # Convert from OCaml to ReasonML | |
| newfile=$(echo $file | sed 's/\.ml/\.re/' | python -c "print raw_input().capitalize()") | |
| echo "Converting $file to $newfile" | |
| esy refmt --parse=ml -p re $file >$newfile | |
| git add "$newfile" | |
| else | |
| [[ "$VERBOSE" = "" ]] || echo "Leaving $file as is" | |
| fi | |
| done | |
| # Converts file name to Reason convention | |
| ls -A *re* | while read file; do | |
| newfile=$(echo $file | sed -r 's/_([a-z])/\U\1/gi') | |
| if [[ "$file" != "$newfile" ]]; then | |
| echo "moving $file to $newfile" | |
| git mv "$file" "$newfile" | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment