Last active
August 29, 2015 14:25
-
-
Save robjens/c19b2d5ac9dc806cb2ef to your computer and use it in GitHub Desktop.
Small executable scripts
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 zsh | |
| # New file location of CS generated | |
| cs=${PWD}/${1:r:t}.coffee | |
| # Resolve absolute path and also symbolic links on positional parameter 1 then | |
| # pipe to the current directory and create a file with the same name but | |
| # different extension. Drops a coffee file in Present Working Directory. | |
| js2coffee -i 4 ${1:A} > $cs | |
| # In case we did get warnings about == not being allowed (and we're not | |
| # checking) just convert any, and only any, TWO equals for three. | |
| sed -i -r 's/={2}/===/g' $cs | |
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 zsh | |
| # TODO learn sed (again) because I can't get this chaining to properly work | |
| # with `-e` or as /.../ { x, y, z} multiline sed | |
| # TODO save to file (mapfile[]) | |
| js2coffee -i 4 $1\ | |
| | sed -r '/^#/ i\\n'\ | |
| | sed -r '/^([^#]*)$/s// \1/g'\ | |
| | sed 's/^# ./#\U&/g'\ | |
| | sed "1i # ${(C)${1:r}}"\ | |
| | sed "2i > ${1:A:h}\n"\ | |
| | sed '/^##.*/ a\\n' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment