Skip to content

Instantly share code, notes, and snippets.

@0xch4z
Created April 8, 2018 15:17
Show Gist options
  • Select an option

  • Save 0xch4z/be2d71d1aaf023d4dcea14d632581843 to your computer and use it in GitHub Desktop.

Select an option

Save 0xch4z/be2d71d1aaf023d4dcea14d632581843 to your computer and use it in GitHub Desktop.
#!/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