Skip to content

Instantly share code, notes, and snippets.

@zph
Created June 7, 2013 18:11
Show Gist options
  • Save zph/5731222 to your computer and use it in GitHub Desktop.
Save zph/5731222 to your computer and use it in GitHub Desktop.
#!/bin/sh
choose_sack_implementation(){
# If so, use prioritized wrapper
if [[ `which ag` ]]; then
command=`which sag`;
elif [[ `which ack` ]]; then
command=`which sack`;
elif [[ `which ack-grep` ]]; then
command=`which sack`
fi
}
choose_bare_bin_implementation(){
if [[ `which ag` ]]; then
command=`which ag`;
elif [[ `which ack` ]]; then
command=`which ack`;
elif [[ `which ack-grep` ]]; then
command=`which ack`;
else
echo "No search tool found... install ag or ack (ack-grep) and also sack"
fi
}
# Check for sack scripts (ack wrapper)
if [[ `which sack` ]];then
choose_sack_implementation
else
choose_bare_bin_implementation
fi
$command 'TODO|FIXME|XXX|HACK'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment