Merge remote-tracking branch 'upstream/master'
commit
6ecbdb3642
|
|
@ -1,5 +1,4 @@
|
|||
aliases/enabled
|
||||
plugins/enabled
|
||||
*/enabled/*
|
||||
.DS_Store
|
||||
custom/*.bash
|
||||
!custom/example.bash
|
||||
|
|
|
|||
41
README.md
41
README.md
|
|
@ -1,46 +1,53 @@
|
|||
# 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](https://github.com/robbyrussell/oh-my-zsh). :)
|
||||
**Bash it** is a mash up of my own bash commands and scripts, other bash stuff I have found.
|
||||
|
||||
Includes some autocompletion tools, theming support, aliases, custom functions, a few stolen pieces from Steve Losh, and more.
|
||||
(And a shameless ripoff of [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh). :)
|
||||
|
||||
Includes autocompletion, themes, aliases, custom functions, a few stolen pieces from Steve Losh, and more.
|
||||
|
||||
## Install
|
||||
|
||||
Check a clone of this repo. You can view what a sample `~/.bash_profile` looks like in `template/bash_profile.template.bash`. If you wanted to use that template, make sure to make a backup of your current `~/.bash_profile` file.
|
||||
1. Check a clone of this repo: `git clone http://github.com/revans/bash-it.git bash_it`
|
||||
2. Run `install.sh` (it automatically backs up your `~/.bash_profile`)
|
||||
3. Edit your `~/.bash_profile` file in order to customize bash-it.
|
||||
|
||||
git clone http://github.com/revans/bash-it.git bash_it
|
||||
|
||||
cp ~/.bash_profile ~/.bash_profile_original
|
||||
cp <path/to/cloned/repo>/template/bash_profile.template.bash ~/.bash_profile
|
||||
**NOTE:**
|
||||
The install script will also prompt you asking if you use [Jekyll](https://github.com/mojombo/jekyll).
|
||||
This is to set up the `.jekyllconfig` file, which stores info necessary to use the Jekyll plugin.
|
||||
|
||||
|
||||
## Help Screens
|
||||
|
||||
bash-it (will show all the help commands)
|
||||
aliases-help
|
||||
rails-help
|
||||
git-help
|
||||
plugins-help
|
||||
```
|
||||
bash-it (will show all the help commands)
|
||||
aliases-help
|
||||
rails-help
|
||||
git-help
|
||||
plugins-help
|
||||
```
|
||||
|
||||
## Your Custom scripts, aliases, and functions
|
||||
|
||||
For custom scripts, and aliases, you can create the following files and they will be ignored by the git repo:
|
||||
For custom scripts, and aliases, just create the following files (they'll be ignored by the git repo):
|
||||
|
||||
* `aliases/custom.aliases.bash`
|
||||
* `lib/custom.bash`
|
||||
* `plugins/custom.plugins.bash`
|
||||
|
||||
and anything in the custom directory will be ignored with the exception of `custom/example.bash`.
|
||||
Anything in the custom directory will be ignored, with the exception of `custom/example.bash`.
|
||||
|
||||
## Themes
|
||||
|
||||
There are a few bash-it themes, but I'm hoping the community will jump in and create their own custom prompts and share their creations with everyone else by submitting a pull request to me (revans).
|
||||
There are a few bash it themes. If you've created your own custom prompts, I'd love it if you shared with everyone else! Just submit a Pull Request to me (revans).
|
||||
|
||||
## Help out
|
||||
|
||||
I think all of us have our own custom scripts that we have added over time and so following in the footsteps of oh-my-zsh, bash-it was created as a framework for those who choose to use bash as their shell. As a community, I'm excited to see what everyone else has in their custom toolbox and am hoping that they'll share it with everyone by submitting a pull request to bash-it.
|
||||
I think everyone has their own custom scripts accumulated over time. And so, following in the footsteps of oh-my-zsh, bash it is a framework for easily customizing your bash shell. Everyone's got a custom toolbox, so let's start making them even better, **as a community!**
|
||||
|
||||
So, if you have contributions to bash-it, please send me a pull request and I'll take a look at it and commit it to the repo as long as it looks good. If you do change an existing command, please give an explanation as to why. That will help a lot when I merge your changes in. Thanks, and happing bashing!
|
||||
Send me a pull request and I'll merge it as long as it looks good. If you change an existing command, please give an explanation why. That will help a lot when I merge your changes in.
|
||||
|
||||
Thanks, and happing bashing!
|
||||
|
||||
|
||||
## Contributors
|
||||
|
|
|
|||
|
|
@ -46,15 +46,6 @@ alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
|
|||
alias md='mkdir -p'
|
||||
alias rd=rmdir
|
||||
|
||||
# show / hide hidden files
|
||||
alias showhidden="defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder"
|
||||
alias hidehidden="defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder"
|
||||
# display IP address
|
||||
alias myip="echo ethernet:; ipconfig getifaddr en0; echo wireless:; ipconfig getifaddr en1"
|
||||
|
||||
# http://snippets.dzone.com/posts/show/2486
|
||||
alias killsvn="find . -name ".svn" -type d -exec rm -rf {} \;"
|
||||
|
||||
function aliases-help() {
|
||||
echo "Generic Alias Usage"
|
||||
echo
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ case $OSTYPE in
|
|||
;;
|
||||
esac
|
||||
|
||||
|
||||
|
||||
function git-help() {
|
||||
echo "Git Custom Aliases Usage"
|
||||
echo
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
# Open the root of your site in your vim or builtin cd to it
|
||||
|
||||
if [[ $EDITOR = "vim" ]]
|
||||
then
|
||||
alias newentry="builtin cd $JEKYLL_LOCAL_ROOT && $EDITOR ."
|
||||
else
|
||||
alias newentry="builtin cd $JEKYLL_LOCAL_ROOT"
|
||||
fi
|
||||
|
||||
# Build and locally serve the site
|
||||
|
||||
alias testsite="builtin cd $JEKYLL_LOCAL_ROOT && jekyll --server --auto"
|
||||
|
||||
# Build but don't locally serve the site
|
||||
|
||||
alias buildsite="builtin cd $JEKYLL_LOCAL_ROOT && rm -rf _site/ && jekyll"
|
||||
|
||||
# Rsync the site to the remote server
|
||||
|
||||
alias deploysite="builtin cd $JEKYLL_LOCAL_ROOT && rsync -rz _site/ $JEKYLL_REMOTE_ROOT"
|
||||
|
||||
alias jkas="jekyll --auto --server"
|
||||
alias rmjkas="rm -rf _site/* && jkas"
|
||||
|
|
@ -14,7 +14,6 @@ alias dashcode="open -a dashcode"
|
|||
alias f='open -a Finder '
|
||||
alias textedit='open -a TextEdit'
|
||||
alias hex='open -a "Hex Fiend"'
|
||||
alias gitx="open -a GitX"
|
||||
|
||||
if [ -s /usr/bin/firefox ] ; then
|
||||
unalias firefox
|
||||
|
|
|
|||
48
bash_it.sh
48
bash_it.sh
|
|
@ -17,37 +17,22 @@ do
|
|||
source $config_file
|
||||
done
|
||||
|
||||
# Tab Completion
|
||||
COMPLETION="${BASH}/completion/*.bash"
|
||||
for config_file in $COMPLETION
|
||||
# Load enabled aliases, completion, plugins
|
||||
for file_type in "aliases" "completion" "plugins"
|
||||
do
|
||||
source $config_file
|
||||
done
|
||||
|
||||
# Plugins
|
||||
if [ ! -d "${BASH}/plugins/enabled" ]
|
||||
then
|
||||
mkdir "${BASH}/plugins/enabled"
|
||||
ln -s ${BASH}/plugins/available/* "${BASH}/plugins/enabled"
|
||||
fi
|
||||
PLUGINS="${BASH}/plugins/enabled/*.bash"
|
||||
for config_file in $PLUGINS
|
||||
do
|
||||
source $config_file
|
||||
done
|
||||
|
||||
# Aliases
|
||||
if [ ! -d "${BASH}/aliases/enabled" ]
|
||||
then
|
||||
mkdir "${BASH}/aliases/enabled"
|
||||
ln -s ${BASH}/aliases/available/* "${BASH}/aliases/enabled"
|
||||
fi
|
||||
FUNCTIONS="${BASH}/aliases/enabled/*.bash"
|
||||
for config_file in $FUNCTIONS
|
||||
do
|
||||
source $config_file
|
||||
if [ ! -d "${BASH}/${file_type}/enabled" ]
|
||||
then
|
||||
mkdir "${BASH}/${file_type}/enabled"
|
||||
ln -s ${BASH}/${file_type}/available/* "${BASH}/${file_type}/enabled"
|
||||
fi
|
||||
FILES="${BASH}/${file_type}/enabled/*.bash"
|
||||
for config_file in $FILES
|
||||
do
|
||||
source $config_file
|
||||
done
|
||||
done
|
||||
|
||||
# Load any custom aliases that the user has added
|
||||
if [ -e "${BASH}/aliases/custom.aliases.bash" ]
|
||||
then
|
||||
source "${BASH}/aliases/custom.aliases.bash"
|
||||
|
|
@ -71,6 +56,13 @@ PREVIEW="less"
|
|||
[ -s /usr/bin/gloobus-preview ] && PREVIEW="gloobus-preview"
|
||||
[ -s /Applications/Preview.app ] && PREVIEW="/Applications/Preview.app"
|
||||
|
||||
# Load all the Jekyll stuff
|
||||
|
||||
if [ -e $HOME/.jekyllconfig ]
|
||||
then
|
||||
. $HOME/.jekyllconfig
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Custom Help
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env bash
|
||||
# Completion for gem
|
||||
|
||||
if [ -z "$REMOTE_GEMS" ]
|
||||
then
|
||||
REMOTE_GEMS=( $(gem list --remote --no-versions | tr '\n' ' ') )
|
||||
fi
|
||||
|
||||
if [ -z "$LOCAL_GEMS" ]
|
||||
then
|
||||
LOCAL_GEMS=( $(gem list --no-versions | sed 's/\*\*\* LOCAL GEMS \*\*\*//' | tr '\n' ' ') )
|
||||
fi
|
||||
|
||||
_installcomp() {
|
||||
local cur=${COMP_WORDS[COMP_CWORD]}
|
||||
COMPREPLY=( $(compgen -W "${REMOTE_GEMS[*]}" -- $cur) )
|
||||
}
|
||||
|
||||
_uninstallcomp() {
|
||||
local cur=${COMP_WORDS[COMP_CWORD]}
|
||||
COMPREPLY=( $(compgen -W "${LOCAL_GEMS[*]}" -- $cur) )
|
||||
}
|
||||
|
||||
_gem() {
|
||||
local cur=${COMP_WORDS[COMP_CWORD]}
|
||||
local prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
case $prev in
|
||||
install)
|
||||
_installcomp
|
||||
return 0
|
||||
;;
|
||||
uninstall)
|
||||
_uninstallcomp
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
local commands=(build cert check cleanup contents dependency environment fetch generate_index help install list lock outdated owner pristine push query rdoc search server sources specification stale uninstall unpack update which)
|
||||
COMPREPLY=( $(compgen -W "${commands[*]}" -- $cur) )
|
||||
}
|
||||
|
||||
complete -F _gem gem
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cp $HOME/.bash_profile $HOME/.bash_profile.bak
|
||||
|
||||
echo "Your original .bash_profile has been backed up to .bash_profile.bak"
|
||||
|
||||
cp $HOME/.bash_it/template/bash_profile.template.bash $HOME/.bash_profile
|
||||
|
||||
echo "Copied the template .bash_profile into ~/.bash_profile, edit this file to customize bash-it"
|
||||
|
||||
while true
|
||||
do
|
||||
read -p "Do you use Jekyll? (If you don't know what Jekyll is, answer 'n') [Y/N] " RESP
|
||||
|
||||
case $RESP
|
||||
in
|
||||
[yY])
|
||||
cp $HOME/.bash_it/template/jekyllconfig.template.bash $HOME/.jekyllconfig
|
||||
echo "Copied the template .jekyllconfig into your home directory. Edit this file to customize bash-it for using the Jekyll plugins"
|
||||
break
|
||||
;;
|
||||
[nN])
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "Please enter Y or N"
|
||||
esac
|
||||
done
|
||||
|
|
@ -5,13 +5,6 @@ function git_remote {
|
|||
git remote add origin $GIT_HOSTING:$1.git
|
||||
}
|
||||
|
||||
# git add remote branch
|
||||
function garb() {
|
||||
echo "Adding remote branch '$1'";
|
||||
git config branch.$1.remote origin;
|
||||
git config branch.$1.merge refs/heads/$1;
|
||||
}
|
||||
|
||||
function git_first_push {
|
||||
echo "Running: git push origin master:refs/heads/master"
|
||||
git push origin master:refs/heads/master
|
||||
|
|
@ -99,3 +92,4 @@ else
|
|||
echo "you're currently not in a git repository"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,208 +1,346 @@
|
|||
#!/bin/bash
|
||||
|
||||
editpost() {
|
||||
builtin cd "$JEKYLL_LOCAL_ROOT/_posts"
|
||||
unset SITE
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Error: no site specified."
|
||||
echo "The site is the name of the directory your project is in."
|
||||
return 1
|
||||
fi
|
||||
|
||||
COUNTER=1
|
||||
NUMBER="$RANDOM"
|
||||
TMPFILE="/tmp/editpost-$NUMBER"
|
||||
for site in ${SITES[@]}
|
||||
do
|
||||
if [ "$(basename $site)" = "$1" ]
|
||||
then
|
||||
SITE=$site
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
for POST in *
|
||||
do
|
||||
DATE=`echo $POST | grep -oE "[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}"`
|
||||
TITLE=`cat $POST | grep -oE "title: (.+)"`
|
||||
TITLE=`echo $TITLE | sed 's/title: //'`
|
||||
echo "$COUNTER) $DATE $TITLE" >> "$TMPFILE"
|
||||
POSTS[$COUNTER]=$POST
|
||||
COUNTER=`expr $COUNTER + 1`
|
||||
done
|
||||
less $TMPFILE
|
||||
read -p "Number of post to edit: " POST_TO_EDIT
|
||||
if [ -z "$EDITOR" ]
|
||||
then
|
||||
nano "${POSTS[$POST_TO_EDIT]}"
|
||||
else
|
||||
"$EDITOR" "${POSTS[$POST_TO_EDIT]}"
|
||||
fi
|
||||
if [ -z "$SITE" ]
|
||||
then
|
||||
echo "No such site."
|
||||
return 1
|
||||
fi
|
||||
|
||||
builtin cd "$SITE/_posts"
|
||||
|
||||
COUNTER=1
|
||||
NUMBER="$RANDOM"
|
||||
TMPFILE="/tmp/editpost-$NUMBER"
|
||||
|
||||
for POST in *
|
||||
do
|
||||
DATE=`echo $POST | grep -oE "[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}"`
|
||||
TITLE=`cat $POST | grep -oE "title: (.+)"`
|
||||
TITLE=`echo $TITLE | sed 's/title: //'`
|
||||
echo "$COUNTER) $DATE $TITLE" >> "$TMPFILE"
|
||||
POSTS[$COUNTER]=$POST
|
||||
COUNTER=`expr $COUNTER + 1`
|
||||
done
|
||||
less $TMPFILE
|
||||
read -p "Number of post to edit: " POST_TO_EDIT
|
||||
if [ -z "$JEKYLL_EDITOR" ]
|
||||
then
|
||||
nano "${POSTS[$POST_TO_EDIT]}"
|
||||
else
|
||||
"$JEKYLL_EDITOR" "${POSTS[$POST_TO_EDIT]}"
|
||||
fi
|
||||
}
|
||||
|
||||
jknewpost() {
|
||||
newpost() {
|
||||
unset SITE
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Error: no site specified."
|
||||
echo "The site is the name of the directory your project is in."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# 'builtin cd' into the local jekyll root
|
||||
if [ -z "$SITE" ]
|
||||
then
|
||||
echo "No such site."
|
||||
return 1
|
||||
fi
|
||||
|
||||
builtin cd "$JEKYLL_LOCAL_ROOT/_posts"
|
||||
loc=0
|
||||
|
||||
# Get the date for the new post's filename
|
||||
for site in ${SITES[@]}
|
||||
do
|
||||
if [ "$(basename $site)" = "$1" ]
|
||||
then
|
||||
SITE=$site
|
||||
JEKYLL_FORMATTING=${MARKUPS[$loc]}
|
||||
break
|
||||
fi
|
||||
loc=$(($loc+1))
|
||||
done
|
||||
|
||||
FNAME_DATE=$(date "+%Y-%m-%d")
|
||||
# 'builtin cd' into the local jekyll root
|
||||
|
||||
# If the user is using markdown formatting, let them choose what type of post they want. Sort of like Tumblr.
|
||||
builtin cd "$SITE/_posts"
|
||||
|
||||
OPTIONS="Text Quote Image Audio Video Link"
|
||||
# Get the date for the new post's filename
|
||||
|
||||
if [ $JEKYLL_FORMATTING = "markdown" -o $JEKYLL_FORMATTING = "textile" ]
|
||||
then
|
||||
select OPTION in $OPTIONS
|
||||
do
|
||||
if [[ $OPTION = "Text" ]]
|
||||
then
|
||||
POST_TYPE="Text"
|
||||
break
|
||||
fi
|
||||
FNAME_DATE=$(date "+%Y-%m-%d")
|
||||
|
||||
if [[ $OPTION = "Quote" ]]
|
||||
then
|
||||
POST_TYPE="Quote"
|
||||
break
|
||||
fi
|
||||
# If the user is using markdown or textile formatting, let them choose what type of post they want. Sort of like Tumblr.
|
||||
|
||||
if [[ $OPTION = "Image" ]]
|
||||
then
|
||||
POST_TYPE="Image"
|
||||
break
|
||||
fi
|
||||
OPTIONS="Text Quote Image Audio Video Link"
|
||||
|
||||
if [[ $OPTION = "Audio" ]]
|
||||
then
|
||||
POST_TYPE="Audio"
|
||||
break
|
||||
fi
|
||||
if [ $JEKYLL_FORMATTING = "markdown" -o $JEKYLL_FORMATTING = "textile" ]
|
||||
then
|
||||
select OPTION in $OPTIONS
|
||||
do
|
||||
if [[ $OPTION = "Text" ]]
|
||||
then
|
||||
POST_TYPE="Text"
|
||||
break
|
||||
fi
|
||||
|
||||
if [[ $OPTION = "Video" ]]
|
||||
then
|
||||
POST_TYPE="Video"
|
||||
break
|
||||
fi
|
||||
if [[ $OPTION = "Quote" ]]
|
||||
then
|
||||
POST_TYPE="Quote"
|
||||
break
|
||||
fi
|
||||
|
||||
if [[ $OPTION = "Link" ]]
|
||||
then
|
||||
POST_TYPE="Link"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [[ $OPTION = "Image" ]]
|
||||
then
|
||||
POST_TYPE="Image"
|
||||
break
|
||||
fi
|
||||
|
||||
# Get the title for the new post
|
||||
if [[ $OPTION = "Audio" ]]
|
||||
then
|
||||
POST_TYPE="Audio"
|
||||
break
|
||||
fi
|
||||
|
||||
read -p "Enter title of the new post: " POST_TITLE
|
||||
if [[ $OPTION = "Video" ]]
|
||||
then
|
||||
POST_TYPE="Video"
|
||||
break
|
||||
fi
|
||||
|
||||
# Convert the spaces in the title to hyphens for use in the filename
|
||||
if [[ $OPTION = "Link" ]]
|
||||
then
|
||||
POST_TYPE="Link"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
FNAME_POST_TITLE=`echo $POST_TITLE | tr ' ' "-"`
|
||||
# Get the title for the new post
|
||||
|
||||
# Now, put it all together for the full filename
|
||||
read -p "Enter title of the new post: " POST_TITLE
|
||||
|
||||
FNAME="$FNAME_DATE-$FNAME_POST_TITLE.$JEKYLL_FORMATTING"
|
||||
# Convert the spaces in the title to hyphens for use in the filename
|
||||
|
||||
# And, finally, create the actual post file. But we're not done yet...
|
||||
FNAME_POST_TITLE=`echo $POST_TITLE | tr ' ' "-"`
|
||||
|
||||
touch "$FNAME"
|
||||
# Now, put it all together for the full filename
|
||||
|
||||
# Write a little stuff to the file for the YAML Front Matter
|
||||
FNAME="$FNAME_DATE-$FNAME_POST_TITLE.$JEKYLL_FORMATTING"
|
||||
|
||||
echo "---" >> $FNAME
|
||||
# And, finally, create the actual post file. But we're not done yet...
|
||||
|
||||
# Now we have to get the date, again. But this time for in the header (YAML Front Matter) of
|
||||
# the file
|
||||
touch "$FNAME"
|
||||
|
||||
YAML_DATE=$(date "+%B %d %Y %X")
|
||||
# Write a little stuff to the file for the YAML Front Matter
|
||||
|
||||
# Echo the YAML Formatted date to the post file
|
||||
echo "---" >> $FNAME
|
||||
|
||||
echo "date: $YAML_DATE" >> $FNAME
|
||||
# Now we have to get the date, again. But this time for in the header (YAML Front Matter) of
|
||||
# the file
|
||||
|
||||
# Echo the original post title to the YAML Front Matter header
|
||||
YAML_DATE=$(date "+%B %d %Y %X")
|
||||
|
||||
echo "title: $POST_TITLE" >> $FNAME
|
||||
# Echo the YAML Formatted date to the post file
|
||||
|
||||
# And, now, echo the "post" layout to the YAML Front Matter header
|
||||
echo "date: $YAML_DATE" >> $FNAME
|
||||
|
||||
echo "layout: post" >> $FNAME
|
||||
# Echo the original post title to the YAML Front Matter header
|
||||
|
||||
# Close the YAML Front Matter Header
|
||||
echo "title: $POST_TITLE" >> $FNAME
|
||||
|
||||
echo "---" >> $FNAME
|
||||
echo >> $FNAME
|
||||
# And, now, echo the "post" layout to the YAML Front Matter header
|
||||
|
||||
# Generate template text based on the post type
|
||||
echo "layout: post" >> $FNAME
|
||||
|
||||
if [[ $JEKYLL_FORMATTING = "markdown" ]]
|
||||
then
|
||||
if [[ $POST_TYPE = "Text" ]]
|
||||
then
|
||||
true
|
||||
fi
|
||||
# Close the YAML Front Matter Header
|
||||
|
||||
if [[ $POST_TYPE = "Quote" ]]
|
||||
then
|
||||
echo "> Quote" >> $FNAME
|
||||
echo >> $FNAME
|
||||
echo "— Author" >> $FNAME
|
||||
fi
|
||||
echo "---" >> $FNAME
|
||||
echo >> $FNAME
|
||||
|
||||
if [[ $POST_TYPE = "Image" ]]
|
||||
then
|
||||
echo "" >> $FNAME
|
||||
fi
|
||||
# Generate template text based on the post type
|
||||
|
||||
if [[ $POST_TYPE = "Audio" ]]
|
||||
then
|
||||
echo "<html><audio src=\"/path/to/audio/file\" controls=\"controls\"></audio></html>" >> $FNAME
|
||||
fi
|
||||
if [[ $JEKYLL_FORMATTING = "markdown" ]]
|
||||
then
|
||||
if [[ $POST_TYPE = "Text" ]]
|
||||
then
|
||||
true
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Video" ]]
|
||||
then
|
||||
echo "<html><video src=\"/path/to/video\" controls=\"controls\"></video></html>" >> $FNAME
|
||||
fi
|
||||
if [[ $POST_TYPE = "Quote" ]]
|
||||
then
|
||||
echo "> Quote" >> $FNAME
|
||||
echo >> $FNAME
|
||||
echo "— Author" >> $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 [[ $POST_TYPE = "Image" ]]
|
||||
then
|
||||
echo "" >> $FNAME
|
||||
fi
|
||||
|
||||
if [[ $JEKYLL_FORMATTING = "textile" ]]
|
||||
then
|
||||
if [[ $POST_TYPE = "Text" ]]
|
||||
then
|
||||
true
|
||||
fi
|
||||
if [[ $POST_TYPE = "Audio" ]]
|
||||
then
|
||||
echo "<html><audio src=\"/path/to/audio/file\" controls=\"controls\"></audio></html>" >> $FNAME
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Quote" ]]
|
||||
then
|
||||
echo "bq. Quote" >> $FNAME
|
||||
echo >> $FNAME
|
||||
echo "— Author" >> $FNAME
|
||||
fi
|
||||
if [[ $POST_TYPE = "Video" ]]
|
||||
then
|
||||
echo "<html><video src=\"/path/to/video\" controls=\"controls\"></video></html>" >> $FNAME
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Image" ]]
|
||||
then
|
||||
echo "!url(alt text)" >> $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 [[ $POST_TYPE = "Audio" ]]
|
||||
then
|
||||
echo "<html><audio src=\"/path/to/audio/file\" controls=\"controls\"></audio></html>" >> $FNAME
|
||||
fi
|
||||
if [[ $JEKYLL_FORMATTING = "textile" ]]
|
||||
then
|
||||
if [[ $POST_TYPE = "Text" ]]
|
||||
then
|
||||
true
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Video" ]]
|
||||
then
|
||||
echo "<html><video src=\"/path/to/video\" controls=\"controls\"></video></html>" >> $FNAME
|
||||
fi
|
||||
if [[ $POST_TYPE = "Quote" ]]
|
||||
then
|
||||
echo "bq. Quote" >> $FNAME
|
||||
echo >> $FNAME
|
||||
echo "— Author" >> $FNAME
|
||||
fi
|
||||
|
||||
if [[ $POST_TYPE = "Link" ]]
|
||||
then
|
||||
echo "\"Site\":url" >> $FNAME
|
||||
echo >> $FNAME
|
||||
echo "bq. Quote" >> $FNAME
|
||||
fi
|
||||
fi
|
||||
if [[ $POST_TYPE = "Image" ]]
|
||||
then
|
||||
echo "!url(alt text)" >> $FNAME
|
||||
fi
|
||||
|
||||
# Open the file in your favorite editor
|
||||
if [[ $POST_TYPE = "Audio" ]]
|
||||
then
|
||||
echo "<html><audio src=\"/path/to/audio/file\" controls=\"controls\"></audio></html>" >> $FNAME
|
||||
fi
|
||||
|
||||
"$EDITOR" $FNAME
|
||||
if [[ $POST_TYPE = "Video" ]]
|
||||
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
|
||||
|
||||
"$JEKYLL_EDITOR" $FNAME
|
||||
}
|
||||
|
||||
function testsite() {
|
||||
unset SITE
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Error: no site specified."
|
||||
echo "The site is the name of the directory your project is in."
|
||||
return 1
|
||||
fi
|
||||
|
||||
for site in ${SITES[@]}
|
||||
do
|
||||
if [ "$(basename $site)" = "$1" ]
|
||||
then
|
||||
SITE=$site
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$SITE" ]
|
||||
then
|
||||
echo "No such site."
|
||||
return 1
|
||||
fi
|
||||
|
||||
builtin cd $SITE
|
||||
jekyll --server --auto
|
||||
}
|
||||
|
||||
function buildsite() {
|
||||
unset SITE
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Error: no site specified."
|
||||
echo "The site is the name of the directory your project is in."
|
||||
return 1
|
||||
fi
|
||||
|
||||
for site in ${SITES[@]}
|
||||
do
|
||||
if [ "$(basename $site)" = "$1" ]
|
||||
then
|
||||
SITE=$site
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$SITE" ]
|
||||
then
|
||||
echo "No such site."
|
||||
return 1
|
||||
fi
|
||||
|
||||
builtin cd $SITE
|
||||
rm -rf _site
|
||||
jekyll --no-server
|
||||
}
|
||||
|
||||
function deploysite() {
|
||||
unset SITE
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
echo "Error: no site specified."
|
||||
echo "The site is the name of the directory your project is in."
|
||||
return 1
|
||||
fi
|
||||
|
||||
loc=0
|
||||
|
||||
for site in ${SITES[@]}
|
||||
do
|
||||
if [ "$(basename $site)" = "$1" ]
|
||||
then
|
||||
SITE=$site
|
||||
REMOTE=${REMOTES[$loc]}
|
||||
break
|
||||
fi
|
||||
loc=$(($loc+1))
|
||||
done
|
||||
|
||||
if [ -z "$SITE" ]
|
||||
then
|
||||
echo "No such site."
|
||||
return 1
|
||||
fi
|
||||
|
||||
builtin cd $SITE
|
||||
rsync -rz $REMOTE
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,17 @@ function dock-switch() {
|
|||
echo "dock-switch 3d."
|
||||
fi
|
||||
else
|
||||
echo "sorry. you're currently not using os x"
|
||||
echo "Sorry, this only works on Mac OS X"
|
||||
fi
|
||||
}
|
||||
|
||||
# Download a file and open it in Preview
|
||||
|
||||
function prevcurl() {
|
||||
if [ ! $(uname) = "Darwin" ]
|
||||
then
|
||||
echo "This function only works with Mac OS X"
|
||||
return 1
|
||||
fi
|
||||
curl "$*" | open -fa "Preview"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,18 +26,6 @@ export NGINX_PATH='/opt/nginx'
|
|||
# Don't check mail when opening terminal.
|
||||
unset MAILCHECK
|
||||
|
||||
# Change this to the path of your local jekyll root to use the jekyll aliases
|
||||
|
||||
export JEKYLL_LOCAL_ROOT="$HOME/Sites/jekyllsite"
|
||||
|
||||
# And change this to the remote server and root
|
||||
|
||||
export JEKYLL_REMOTE_ROOT="user@server:/path/to/jekyll/root"
|
||||
|
||||
# And, for the last of the jekyll variables, this is the formatting you use, eg: markdown,
|
||||
# textile, etc. Basically whatever you use as the extension for posts, without the preceding dot
|
||||
|
||||
export JEKYLL_FORMATTING="markdown"
|
||||
|
||||
# Change this to your console based IRC client of choice.
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
# This is a space-delimited list of your Jekyll project paths
|
||||
|
||||
SITES="$HOME/sites/project_1 $HOME/sites/project_2"
|
||||
|
||||
# This is another space-delimited list.
|
||||
# This one is of the remote user@host:path location of your jekyll site
|
||||
# NOTE: The locations of these must correspond to the locations
|
||||
# of the sites in the first list
|
||||
# For instance, the host for the first Jekyll site
|
||||
# must be first in this list, the second second, etc.
|
||||
|
||||
REMOTES="user@host_1:path user@host_2:path"
|
||||
|
||||
# list of markup syntaxes to use for the sites,
|
||||
# Same rules as above. Can be HTML, textile, or markdown
|
||||
|
||||
MARKUPS="markdown textile"
|
||||
|
||||
# If you want to use a different editor for Jekyll, change the value of this variable
|
||||
|
||||
JEKYLL_EDITOR="$EDITOR"
|
||||
|
|
@ -17,11 +17,12 @@ fi
|
|||
|
||||
doubletime_scm_prompt() {
|
||||
CHAR=$(scm_char)
|
||||
if [ $CHAR = $SCM_NONE_CHAR ]
|
||||
then
|
||||
if [ $CHAR = $SCM_NONE_CHAR ]; then
|
||||
return
|
||||
else
|
||||
elif [ $CHAR = $SCM_GIT_CHAR ]; then
|
||||
echo "$(git_prompt_status)"
|
||||
else
|
||||
echo "[$(scm_prompt_info)]"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
prompt_setter() {
|
||||
PS1="${cyan}\W${normal} "
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SCM_THEME_PROMPT_PREFIX="${cyan}(${green}"
|
||||
SCM_THEME_PROMPT_SUFFIX="${cyan})"
|
||||
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
|
||||
SCM_THEME_PROMPT_CLEAN=" ${green}✓"
|
||||
|
||||
prompt() {
|
||||
PS1="$(scm_prompt_info)${reset_color} ${cyan}\W${reset_color} "
|
||||
}
|
||||
|
||||
PROMPT_COMMAND=prompt_setter
|
||||
|
||||
export PS3=">> "
|
||||
PROMPT_COMMAND=prompt
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Based on 'bobby' theme with the addition of virtualenv_prompt
|
||||
#
|
||||
|
||||
SCM_THEME_PROMPT_DIRTY=" ${red}✗"
|
||||
SCM_THEME_PROMPT_CLEAN=" ${green}✓"
|
||||
SCM_THEME_PROMPT_PREFIX=" ${yellow}|${reset_color}"
|
||||
SCM_THEME_PROMPT_SUFFIX="${yellow}|"
|
||||
|
||||
RVM_THEME_PROMPT_PREFIX="|"
|
||||
RVM_THEME_PROMPT_SUFFIX="|"
|
||||
VIRTUALENV_THEME_PROMPT_PREFIX='|'
|
||||
VIRTUALENV_THEME_PROMPT_SUFFIX='|'
|
||||
|
||||
function prompt_command() {
|
||||
PS1="\n${green}$(virtualenv_prompt)${red}$(rvm_version_prompt) ${reset_color}\h ${orange}in ${reset_color}\w\n${yellow}$(scm_char)$(scm_prompt_info) ${yellow}→${white} "
|
||||
}
|
||||
|
||||
PROMPT_COMMAND=prompt_command;
|
||||
Loading…
Reference in New Issue