Created
June 1, 2015 19:51
-
-
Save al-the-x/23830b62877f58c993f2 to your computer and use it in GitHub Desktop.
Copy-pasta FU for managing files and such
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
| between { | |
| if [ $# -lt 1 ]; then | |
| cat <<'USAGE' | |
| usage: between START END | |
| Print input from `stdin` that appears between `START` | |
| and `END` markers, as long as they appear on a single | |
| line. | |
| EXAMPLE | |
| $> between.zsh | between USAGE EXAMPLE | |
| usage: between START END | |
| Print input from `stdin` that appears between `START` | |
| and `END` markers, as long as they appear on a single | |
| line. | |
| USAGE; | |
| return 1 | |
| fi | |
| if [ $# -gt 1 ]; then | |
| gawk "/${1}/{keep=1}/${2}/{keep=0} keep" | |
| else | |
| gawk "/${1}/{keep=1}keep" | |
| fi | |
| } |
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: find out if there's a better way to do this... | |
| function _error { | |
| echo 'error: ' $1 >&2 | |
| } | |
| function _usage { | |
| cat <<'USAGE' | |
| usage: copy-pasta XX--Assignment-Name | |
| Create a `README.md` file in `XX--Assignment-Name/` copying the contents of | |
| `.template/ASSIGNMENT.md` or the file named by the environment variable `$TEMPLATE`, | |
| if it exists. Also make a branch in the current repo named similarly (lowercased) | |
| and add the `README.md` file to the index. | |
| USAGE | |
| } | |
| if [[ $# -lt 1 ]]; then | |
| _error 'missing argument' | |
| _usage; exit 1 | |
| fi | |
| git checkout -b $1:l \ | |
| && ginstall -vCD .templates/${TEMPLATE:-'ASSIGNMENT.md'} $1/README.md \ | |
| && git add $1 \ | |
| && git status -s | |
| # vim: ft=zsh |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This cohort, I give my students a checklist inside of a Markdown code block with requirements:
...that they copy-pasta into their Issues. I also write up some fun checkpoints for each part of the assignment that they can check off as they go. In later weeks, I write up fewer and fewer checkbox and make them fill in "the plan".