Created
April 8, 2018 15:17
-
-
Save 0xch4z/be2d71d1aaf023d4dcea14d632581843 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 | |
| snippet_dir="~/Library/Developer/Xcode/UserData/CodeSnippets/" | |
| op="mv" | |
| function show_help() { | |
| echo " | |
| xc-source-snippets | |
| sources xcode plist snippets to xcode user data | |
| usage: xc-source-snippets [snippet_files] | |
| options: | |
| -c Copies snippet files, instead of moving | |
| -h Show help menu | |
| -d [snippet_dir] Specify snippet directory | |
| " | |
| exit 0 | |
| } | |
| while getopts chd: opt; do | |
| case $opt in | |
| c ) op="cp"; shift ;; | |
| h ) show_help ;; | |
| d ) snippet_dir="$OPTARG"; shift ;; | |
| * ) break ;; | |
| esac | |
| done | |
| if [[ ! -d $snippet_dir ]]; then | |
| mkdir -p $snippet_dir | |
| fi | |
| for snippet in "$@"; do | |
| $op $snippet $snippet_dir/$snippet | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment