Skip to content

Instantly share code, notes, and snippets.

@nacho4d
Created February 19, 2013 08:11
Show Gist options
  • Save nacho4d/4983932 to your computer and use it in GitHub Desktop.
Save nacho4d/4983932 to your computer and use it in GitHub Desktop.
Install *.docset files
#!/bin/sh
#
# Description:
# Installs the given *.docset so it is visible by Xcode, Dash, etc
#
# Usage:
# installDocumentation path/to/documentation.docset
#
# Check parameters
if [ "$#" -eq 1 ]; then
if [[ -d "$1" ]]; then
DOCSET_INPUT_PATH=$1
if [[ ${DOCSET_INPUT_PATH##*.} -ne "docset" ]]; then
echo "Error : Documentation file must be a *.docset file"
exit 1
fi
else
echo "Error : No documentation was found at \"$1\""
exit 1
fi
else
echo "Error: Miss-usage. This script needs the path to a *.docset file"
exit 1
fi
# Prepare the installation directory
DOCSET_OUTPUT_PATH=$HOME/Library/Developer/Shared/Documentation/DocSets/
mkdir -p $DOCSET_OUTPUT_PATH
# Move (Install) documentation
mv $DOCSET_INPUT_PATH $DOCSET_OUTPUT_PATH
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment