help metadata for base plugin

pull/116/head
Erich Smith 2012-04-28 00:43:38 -04:00
parent a8fcf9f18c
commit a3c3caa0ab
1 changed files with 103 additions and 65 deletions

102
plugins/available/base.plugin.bash 100644 → 100755
View File

@ -2,20 +2,30 @@
# For generic functions.
function ips {
ips ()
{
about display all ip addresses for this host
ifconfig | grep "inet " | awk '{ print $2 }'
}
function down4me() {
down4me ()
{
about checks whether a website is down for you, or everybody
param 1: website url
example $ down4me http://www.google.com
curl -s "http://www.downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g'
}
function myip {
myip ()
{
about displays your ip address, as seen by the Internet
res=$(curl -s checkip.dyndns.org | grep -Eo '[0-9\.]+')
echo -e "Your public IP is: ${echo_bold_green} $res ${echo_normal}"
}
pass() {
pass ()
{
about generates password from random dictionary words
which gshuf &> /dev/null
if [ $? -eq 1 ]
then
@ -28,9 +38,11 @@ pass() {
echo "Without (use this as the pass): $(echo $pass | tr -d ' ')"
}
# Function for previewing markdown files in the browser
function pmdown() {
pmdown ()
{
about preview markdown file in a browser
param 1: markdown file
example $ pmdown README.md
if command -v markdown &>/dev/null
then
markdown $1 | browser
@ -39,47 +51,65 @@ function pmdown() {
fi
}
# Make a directory and immediately 'cd' into it
function mkcd() {
mkcd ()
{
about make a directory and cd into it
param path to create
example $ mkcd foo
example $ mkcd /tmp/img/photos/large
mkdir -p "$*"
cd "$*"
}
# Search through directory contents with grep
function lsgrep(){
lsgrep ()
{
about search through directory contents with grep
ls | grep "$*"
}
# View man documentation in Preview
pman () {
pman ()
{
about view man documentation in Preview
param 1: man page to view
example $ pman bash
man -t "${1}" | open -f -a $PREVIEW
}
pcurl() {
pcurl ()
{
about download file and Preview it
param 1: download URL
example $ pcurl http://www.irs.gov/pub/irs-pdf/fw4.pdf
curl "${1}" | open -f -a $PREVIEW
}
pri() {
pri ()
{
about display information about Ruby classes, modules, or methods, in Preview
param 1: Ruby method, module, or class
example $ pri Array
ri -T "${1}" | open -f -a $PREVIEW
}
quiet() {
quiet ()
{
$* &> /dev/null &
}
banish-cookies() {
banish-cookies ()
{
about redirect .adobe and .macromedia files to /dev/null
rm -r ~/.macromedia ~/.adobe
ln -s /dev/null ~/.adobe
ln -s /dev/null ~/.macromedia
}
# disk usage per directory
# in Mac OS X and Linux
usage ()
{
about disk usage per directory, in Mac OS X and Linux
param 1: directory name
if [ $(uname) = "Darwin" ]; then
if [ -n $1 ]; then
du -hd $1
@ -96,8 +126,11 @@ usage ()
fi
}
# One thing todo
function t() {
t ()
{
about one thing todo
param if not set, display todo item
param 1: todo text
if [[ "$*" == "" ]] ; then
cat ~/.t
else
@ -105,14 +138,17 @@ function t() {
fi
}
# Checks for existence of a command
command_exists () {
command_exists ()
{
about checks for existence of a command
param 1: command to check
example $ command_exists ls && echo 'exists'
type "$1" &> /dev/null ;
}
# List all plugins and functions defined by bash-it
function plugins-help() {
plugins-help ()
{
about list all plugins and functions defined by bash-it
echo "bash-it Plugins Help-Message"
echo
@ -128,10 +164,12 @@ function plugins-help() {
| grep -v "COMPREPLY=()" | sed -e "s/()//"
}
# back up file with timestamp
# useful for administrators and configs
buf () {
filename=$1
filetime=$(date +%Y%m%d_%H%M%S)
buf ()
{
about back up file with timestamp
param filename
local filename=$1
local filetime=$(date +%Y%m%d_%H%M%S)
cp ${filename} ${filename}_${filetime}
}