Merge remote branch 'upstream/master'
commit
98576b34b8
|
|
@ -1,6 +1,6 @@
|
|||
# Bash it
|
||||
|
||||
'Bash it' is a mash up of my own bash commands and scripts, other bash stuff I have found and a shameless ripoff of oh-my-zsh. :)
|
||||
'Bash it' is a mash up of my own bash commands and scripts, other bash stuff I have found and a shameless ripoff of [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh). :)
|
||||
|
||||
Includes some autocompletion tools, theming support, aliases, custom functions, a few stolen pieces from Steve Losh, and more.
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,116 @@
|
|||
#!/bin/bash
|
||||
# hcht.plugin.bash: the handmade commandline history tool
|
||||
# Copyright: (C) 2010 Florian Baumann <flo@noqqe.de>
|
||||
# License: GPL-3 <http://www.gnu.org/licenses/gpl-3.0.txt>
|
||||
# Date: Dienstag 2010-11-30
|
||||
|
||||
### readme
|
||||
# basiclly the handmade commandline history tool was made for storing
|
||||
# informations. yeah, you're right. sounds a bit boring. many other
|
||||
# applications can do this much better. but storing things from commandline?
|
||||
#
|
||||
# hcht was fitted to work at your terminal.
|
||||
# your daily stuff like notices, todos, commands or output from a command.
|
||||
# all these things will be stored without complex syntax.
|
||||
#
|
||||
# once you defined your storing-directory you will be able to easily
|
||||
# save all the stuff listed above.
|
||||
#
|
||||
|
||||
### create a file
|
||||
# the basic feature. open a file, do stuff and save.
|
||||
#
|
||||
# $ hcht evilcommand.hch
|
||||
#
|
||||
# this will create a new file or edit a existing one.
|
||||
# paste your command or notice in your favorite editor
|
||||
|
||||
### show all stored informations
|
||||
# to get an overview of your storedir:
|
||||
#
|
||||
# $ hcht
|
||||
|
||||
### todo with a whole sentence
|
||||
# you can give hcht a bunch of parameters
|
||||
#
|
||||
# $ hcht this is a long reminder about a anything
|
||||
|
||||
### save last executed command
|
||||
# lets say you did a great hack at your system and you
|
||||
# want to save it without complicated use of coping:
|
||||
#
|
||||
# $ hcht !!
|
||||
#
|
||||
# the "!!" will repeat the _last_ command you executed at
|
||||
# your terminal. after asking you about a name the hch file
|
||||
# will be saved.
|
||||
|
||||
### read from stdin
|
||||
# hcht is also able to read anything from stdin.
|
||||
#
|
||||
# $ cat any_important_logfile | hcht anylog
|
||||
#
|
||||
# "anylog" will be the name of the saved file.
|
||||
|
||||
hcht() {
|
||||
# configured?
|
||||
if [ -z $hchtstoredir ]; then
|
||||
echo "ERROR: handmade commandline history tool isn't configured."
|
||||
return 1
|
||||
else
|
||||
hchtstoredir=$(echo $hchtstoredir | sed -e 's/\/$//')
|
||||
fi
|
||||
|
||||
# dir available?
|
||||
if [ ! -d $hchtstoredir ]; then
|
||||
echo "ERROR: No such directory: $hchtstoredir"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# get favorite editor
|
||||
if [ -z $EDITOR ]; then
|
||||
EDITOR=$(which vim || which nano)
|
||||
fi
|
||||
|
||||
# check if stdin-data is present and save content
|
||||
if [ "$(tty)" = "not a tty" ]; then
|
||||
hchname=$(echo $1 | sed -e 's/\ //g')
|
||||
if [ -z $hchname ]; then
|
||||
cat < /dev/stdin >> $hchtstoredir/$(date +%Y%m%d%H%M%S).hch
|
||||
else
|
||||
cat < /dev/stdin >> $hchtstoredir/$hchname.hch
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
# list all hch files if no parameter is given
|
||||
if [ $# -eq 0 ]; then
|
||||
for file in $(ls $hchtstoredir); do
|
||||
echo $file
|
||||
done
|
||||
return 0
|
||||
fi
|
||||
|
||||
# if a *.hch file is given start editing or creating it
|
||||
if [ "$#" -eq "1" ]; then
|
||||
if echo "$1" | grep -q -e ".*.hch$" ; then
|
||||
$EDITOR ${hchtstoredir}/${1}
|
||||
return 0
|
||||
else
|
||||
$EDITOR ${hchtstoredir}/${1}.hch
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# autocreate a new hch
|
||||
if [ "$#" -gt "1" ]; then
|
||||
echo -n "define a name: " ; read hchname
|
||||
hchname=$(echo $hchname | sed -e 's/\ /_/g')
|
||||
if [ -z "$hchname" ]; then
|
||||
echo "$*" > $hchtstoredir/${1}-$(date +%Y%m%d%H%M%S).hch
|
||||
else
|
||||
echo "$*" > ${hchtstoredir}/${hchname}.hch
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
|
@ -12,7 +12,7 @@ newpost() {
|
|||
|
||||
# If the user is using markdown formatting, let them choose what type of post they want. Sort of like Tumblr.
|
||||
|
||||
OPTIONS="Text Quote Image Audio Video"
|
||||
OPTIONS="Text Quote Image Audio Video Link"
|
||||
|
||||
if [ $JEKYLL_FORMATTING = "markdown" -o $JEKYLL_FORMATTING = "textile" ]
|
||||
then
|
||||
|
|
@ -47,6 +47,12 @@ newpost() {
|
|||
POST_TYPE="Video"
|
||||
break
|
||||
fi
|
||||
|
||||
if [[ $OPTION = "Link" ]]
|
||||
then
|
||||
POST_TYPE="Link"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
|
@ -122,6 +128,15 @@ newpost() {
|
|||
then
|
||||
echo "<html><video src=\"/path/to/video\" controls=\"controls\"></video></html>" >> $FNAME
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Link" ]]
|
||||
then
|
||||
echo "[link][1]" >> $FNAME
|
||||
echo >> $FNAME
|
||||
echo "> Quote" >> $FNAME
|
||||
echo >> $FNAME
|
||||
echo "[1]: url" >> $FNAME
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $JEKYLL_FORMATTING = "textile" ]]
|
||||
|
|
@ -152,6 +167,13 @@ newpost() {
|
|||
then
|
||||
echo "<html><video src=\"/path/to/video\" controls=\"controls\"></video></html>" >> $FNAME
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Link" ]]
|
||||
then
|
||||
echo "\"Site\":url" >> $FNAME
|
||||
echo >> $FNAME
|
||||
echo "bq. Quote" >> $FNAME
|
||||
fi
|
||||
fi
|
||||
|
||||
# Open the file in your favorite editor
|
||||
|
|
|
|||
|
|
@ -47,5 +47,8 @@ export IRC_CLIENT='irssi'
|
|||
|
||||
export TODO="t"
|
||||
|
||||
# Set store directory for handmade commandline history tool
|
||||
export hchtstoredir="$HOME/.hcht"
|
||||
|
||||
# Load Bash It
|
||||
source $BASH/bash_it.sh
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
# n0qorg theme by Florian Baumann <flo@noqqe.de>
|
||||
|
||||
## look-a-like
|
||||
# host directory (branch*)»
|
||||
# for example:
|
||||
# ananas ~/Code/bash-it/themes (master*)»
|
||||
PROMPT="${bold_blue}\[\$(hostname)\]${normal} \w${normal} ${bold_white}\[\$(git_prompt_info)\]${normal}» "
|
||||
|
||||
## git-theme
|
||||
# feel free to change git chars.
|
||||
GIT_THEME_PROMPT_DIRTY="${bold_blue}*${bold_white}"
|
||||
GIT_THEME_PROMPT_CLEAN=""
|
||||
GIT_THEME_PROMPT_PREFIX="${bold_blue}(${bold_white}"
|
||||
GIT_THEME_PROMPT_SUFFIX="${bold_blue})"
|
||||
|
||||
## alternate chars
|
||||
#
|
||||
SCM_THEME_PROMPT_DIRTY="*"
|
||||
SCM_THEME_PROMPT_CLEAN=""
|
||||
SCM_THEME_PROMPT_PREFIX="("
|
||||
SCM_THEME_PROMPT_SUFFIX=")"
|
||||
Loading…
Reference in New Issue