Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Commit

Permalink
Use two-character space indents everywhere.
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMcQuaid committed Dec 17, 2014
1 parent f869e3b commit f1c7a2c
Show file tree
Hide file tree
Showing 10 changed files with 149 additions and 150 deletions.
6 changes: 3 additions & 3 deletions dedrm-rename.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mkdir -p ~/Documents/Books/DeDRM/
cd ~/Documents/Books/DeDRM/
for OLDFILENAME in *.mobi
do
NEWFILENAME=$(echo $OLDFILENAME | sed -e 's/[A-Z0-9]*_\(.*\)/\1/' \
-e 's/_/ /g' -e 's/EBOK //' -e 's/ nodrm\.mobi/.mobi/' -e 's/ / - /')
mv -iv "$OLDFILENAME" "$NEWFILENAME"
NEWFILENAME=$(echo $OLDFILENAME | sed -e 's/[A-Z0-9]*_\(.*\)/\1/' \
-e 's/_/ /g' -e 's/EBOK //' -e 's/ nodrm\.mobi/.mobi/' -e 's/ / - /')
mv -iv "$OLDFILENAME" "$NEWFILENAME"
done
20 changes: 10 additions & 10 deletions git-gc-global
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ IFS="
"

echorun() {
echo + "$@"
$*
echo + "$@"
$*
}

for SCM in $(find -L $CURRENT -name .git)
do
DIRECTORY=$(dirname $SCM)
cd $DIRECTORY
echo == Garbage collecting $(basename $DIRECTORY)
if [ -d .git ]
then
echorun git gc --aggressive
fi
echo
DIRECTORY=$(dirname $SCM)
cd $DIRECTORY
echo == Garbage collecting $(basename $DIRECTORY)
if [ -d .git ]
then
echorun git gc --aggressive
fi
echo
done
4 changes: 2 additions & 2 deletions git-mergetool-opendiff
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Script to be used with git mergetool to handle opendiff nicely.
if [ $# != 6 ]
then
echo "ERROR: Don't call this script directly; use 'git mergetool' instead."
exit
echo "ERROR: Don't call this script directly; use 'git mergetool' instead."
exit
fi

# Kill all instances of FileMerge already running
Expand Down
2 changes: 1 addition & 1 deletion git-rebase-all-branches
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ git fetch --all
git checkout staging && git rebase origin/staging
for i in $(git branch|egrep -v '\*|staging')
do
git checkout $i && git rebase origin/master
git checkout $i && git rebase origin/master
done

git checkout $GIT_CURRENT_BRANCH
16 changes: 8 additions & 8 deletions git-set-email-global
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ IFS="

for SCM in $(find -L $CURRENT -name .git)
do
DIRECTORY=$(dirname $SCM)
cd $DIRECTORY
if [ -d .git ]
DIRECTORY=$(dirname $SCM)
cd $DIRECTORY
if [ -d .git ]
then
if ! git config --local --get user.email >/dev/null
then
if ! git config --local --get user.email >/dev/null
then
echo == Setting email to $EMAIL for $(basename $DIRECTORY)
git config --local --add user.email $EMAIL
fi
echo == Setting email to $EMAIL for $(basename $DIRECTORY)
git config --local --add user.email $EMAIL
fi
fi
done
44 changes: 22 additions & 22 deletions scm-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@ IFS="
"

echorun() {
echo + "$@"
$*
echo + "$@"
$*
}

for SCM in $(find -L $CURRENT -name .git) $(find $CURRENT -name .svn)
do
DIRECTORY=$(dirname $SCM)
cd $DIRECTORY
if [ -d ../.svn ] || echo $DIRECTORY | grep -q "vendor/ruby"
then
continue
fi
echo == Updating $(basename $DIRECTORY)
if [ -d .git/svn ]
then
echorun git svn fetch
echorun git svn rebase
elif [ -d .git ]
then
echorun git fetch --all
[ -n "$(git remote -v)" ] && echorun git pull
elif [ -d .svn ]
then
echorun svn update
fi
echo
DIRECTORY=$(dirname $SCM)
cd $DIRECTORY
if [ -d ../.svn ] || echo $DIRECTORY | grep -q "vendor/ruby"
then
continue
fi
echo == Updating $(basename $DIRECTORY)
if [ -d .git/svn ]
then
echorun git svn fetch
echorun git svn rebase
elif [ -d .git ]
then
echorun git fetch --all
[ -n "$(git remote -v)" ] && echorun git pull
elif [ -d .svn ]
then
echorun svn update
fi
echo
done
10 changes: 5 additions & 5 deletions scp-to-http.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ UPLOADHOST="$2"
WWWDIR="$3"
if [ -z "$5" ]
then
FILEPATH="$4"
FILEPATH="$4"
else
MOVEPATH="$4"
FILEPATH="$5"
MOVEPATH="$4"
FILEPATH="$5"
fi

FILENAME=$(basename "$FILEPATH")
Expand All @@ -24,8 +24,8 @@ echo "$FILEPATH uploaded to $HTTP"

if [ $OSX ]
then
echo $HTTP | pbcopy
echo "URL copied to clipboard."
echo $HTTP | pbcopy
echo "URL copied to clipboard."
fi

[ -n "$MOVEPATH" ] && mv -v "$FILEPATH" "$MOVEPATH"
164 changes: 82 additions & 82 deletions svn-git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,104 +2,104 @@

SVN_ALIAS=$(alias svn 2>/dev/null|sed -e 's/alias svn=//')
svn_root() {
[ -d .svn ] || (echo "No .svn directory found" && return)
[ -d .svn ] || (echo "No .svn directory found" && return)

OLDPWD=$PWD
while [ -d ../.svn ]
do
cd ..
done
OLDPWD=$PWD
while [ -d ../.svn ]
do
cd ..
done

SVN_INFO_URL=$(svn info 2>/dev/null | grep URL:) || return
SVN_URL=$(echo $SVN_INFO | sed -e 's/URL: //')
SVN_BRANCH=$(echo $SVN_INFO | grep -oe '\(trunk\|branches/[^/]\+\|tags/[^/]\+\)')
[ -n "$SVN_BRANCH" ] || return
SVN_ROOT=${SVN_URL%$SVN_BRANCH}
echo "$SVN_ROOT"
cd $OLDPWD
SVN_INFO_URL=$(svn info 2>/dev/null | grep URL:) || return
SVN_URL=$(echo $SVN_INFO | sed -e 's/URL: //')
SVN_BRANCH=$(echo $SVN_INFO | grep -oe '\(trunk\|branches/[^/]\+\|tags/[^/]\+\)')
[ -n "$SVN_BRANCH" ] || return
SVN_ROOT=${SVN_URL%$SVN_BRANCH}
echo "$SVN_ROOT"
cd $OLDPWD
}

# Makes changing branches in Subversion more like Git
svn_git_checkout() {
if echo "$@" | grep "://"
then
svn "$@"
return
fi
if echo "$@" | grep "://"
then
svn "$@"
return
fi

NEW_BRANCH="$1"
[ -n "$NEW_BRANCH" ] || (echo "No branch specified" && return)
[ -d .svn ] || (echo "No .svn directory found" && return)
NEW_BRANCH="$1"
[ -n "$NEW_BRANCH" ] || (echo "No branch specified" && return)
[ -d .svn ] || (echo "No .svn directory found" && return)

SVN_ROOT=$(svn_root)
SVN_ROOT=$(svn_root)

if [ $NEW_BRANCH != "trunk" ]
then
echo "Searching branches for $NEW_BRANCH"
for BRANCH in $(svn ls ${SVN_ROOT}/branches)
do
[ "$NEW_BRANCH/" != $BRANCH ] && continue
FOUND_BRANCH="branches/$BRANCH"
break
done
if [ $NEW_BRANCH != "trunk" ]
then
echo "Searching branches for $NEW_BRANCH"
for BRANCH in $(svn ls ${SVN_ROOT}/branches)
do
[ "$NEW_BRANCH/" != $BRANCH ] && continue
FOUND_BRANCH="branches/$BRANCH"
break
done

if [ -z "$FOUND_BRANCH" ]
then
echo "Searching tags for $NEW_BRANCH"
for TAG in $(svn ls ${SVN_ROOT}/tags)
do
[ "$NEW_BRANCH/" != $TAG ] && continue
FOUND_BRANCH="tags/$TAG"
break
done
fi
if [ -z "$FOUND_BRANCH" ]
then
echo "Searching tags for $NEW_BRANCH"
for TAG in $(svn ls ${SVN_ROOT}/tags)
do
[ "$NEW_BRANCH/" != $TAG ] && continue
FOUND_BRANCH="tags/$TAG"
break
done
fi

if [ -z "$FOUND_BRANCH" ]
then
echo "Could not find a branch or tag named $NEW_BRANCH"
cd $OLDPWD
return
else
NEW_BRANCH="$FOUND_BRANCH"
fi
fi
if [ -z "$FOUND_BRANCH" ]
then
echo "Could not find a branch or tag named $NEW_BRANCH"
cd $OLDPWD
return
else
NEW_BRANCH="$FOUND_BRANCH"
fi
fi

OLDPWD=$PWD
while [ -d ../.svn ]
do
cd ..
done
OLDPWD=$PWD
while [ -d ../.svn ]
do
cd ..
done

echo svn switch "$SVN_ROOT$NEW_BRANCH"
svn switch "$SVN_ROOT$NEW_BRANCH"
cd $OLDPWD
echo svn switch "$SVN_ROOT$NEW_BRANCH"
svn switch "$SVN_ROOT$NEW_BRANCH"
cd $OLDPWD
}

case "$1" in
co)
svn_git_checkout "$@"
;;
checkout)
svn_git_checkout "$@"
;;
log)
svn "$@"|less -FX
;;
branch)
SVN_ROOT=$(svn_root)
echo "Branches:"
svn ls ${SVN_ROOT}/branches
echo
echo "Tags:"
svn ls ${SVN_ROOT}/tags
;;
diff)
[ -n "$DIFF" ] && DIFF_ARG="--diff-cmd=$DIFF"
svn $DIFF_ARG "$@"|less -FXR
;;
*)
svn "$@"
;;
co)
svn_git_checkout "$@"
;;
checkout)
svn_git_checkout "$@"
;;
log)
svn "$@"|less -FX
;;
branch)
SVN_ROOT=$(svn_root)
echo "Branches:"
svn ls ${SVN_ROOT}/branches
echo
echo "Tags:"
svn ls ${SVN_ROOT}/tags
;;
diff)
[ -n "$DIFF" ] && DIFF_ARG="--diff-cmd=$DIFF"
svn $DIFF_ARG "$@"|less -FXR
;;
*)
svn "$@"
;;
esac

alias svn=$SVN_ALIAS
26 changes: 13 additions & 13 deletions uninstall-xcode-clt.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
#!/bin/sh
for FILE in $(pkgutil --only-files --files com.apple.pkg.DeveloperToolsCLI)
do
FILE="/$FILE"
[ -f $FILE ] || continue
FILE="/$FILE"
[ -f $FILE ] || continue

echo "Removing file: $FILE"
rm -f $FILE
echo "Removing file: $FILE"
rm -f $FILE
done

for DIRECTORY in $(pkgutil --only-dirs --files com.apple.pkg.DeveloperToolsCLI)
do
DIRECTORY="/$DIRECTORY"
[ -d $DIRECTORY ] || continue
DIRECTORY="/$DIRECTORY"
[ -d $DIRECTORY ] || continue

if [ "$(ls -A $DIRECTORY)" ]
then
continue
fi
if [ "$(ls -A $DIRECTORY)" ]
then
continue
fi

DIRECTORY_REMOVED=1
echo "Removing empty directory: $DIRECTORY"
rm -rf $DIRECTORY
DIRECTORY_REMOVED=1
echo "Removing empty directory: $DIRECTORY"
rm -rf $DIRECTORY
done

[ $DIRECTORY_REMOVED ] && echo "Please rerun to remove more CLT files" && exit 1
Expand Down
Loading

0 comments on commit f1c7a2c

Please sign in to comment.