forked from colonelpanic/dotfiles
Tweaks from simlay.
This commit is contained in:
parent
066cf15260
commit
0ad505b780
36
.functions
36
.functions
@ -1,8 +1,36 @@
|
||||
get_col () {
|
||||
for item in `awk "{print \\$$@}"`; do
|
||||
printf $item
|
||||
printf '\n'
|
||||
get_cols () {
|
||||
# Usage: get_cols [file_name] [column_num]
|
||||
column_list=""
|
||||
for column_num in $@; do
|
||||
[ -r $column_num ] && continue
|
||||
|
||||
[ $column_num -lt '0' ] && column_num="(NF + 1 $column_num )" #Negative indices like python's array[-1]
|
||||
|
||||
[ -z $column_list ] && column_num="\$$column_num" || column_num=",\$$column_num" # Place commas appropriately.
|
||||
|
||||
column_list="$column_list$column_num"
|
||||
done
|
||||
unset column_num
|
||||
|
||||
# Is the first parameter a file?
|
||||
if [ -r $1 ]; then
|
||||
awk "{print $column_list}" $1
|
||||
else
|
||||
awk "{print $column_list}"
|
||||
fi
|
||||
unset column_list
|
||||
}
|
||||
|
||||
note() {
|
||||
if [ $# -eq 0 ]; then
|
||||
(ym && exec $EDITOR $HOME/notes/$(git rev-parse --abbrev-ref HEAD)) ;
|
||||
else
|
||||
$EDITOR $HOME/notes/"$*" ;
|
||||
fi
|
||||
}
|
||||
|
||||
list_notes() {
|
||||
ls -c $HOME/notes/ | grep "$*"
|
||||
}
|
||||
|
||||
function get_shas_that_touched() {
|
||||
|
21
bootstrap.sh
21
bootstrap.sh
@ -1,11 +1,20 @@
|
||||
#!/bin/bash
|
||||
cd "$(dirname "${BASH_SOURCE}")"
|
||||
CURRENT_DIRECTORY="$(dirname "${BASH_SOURCE}" | xargs readlink -f)"
|
||||
cd $CURRENT_DIRECTORY
|
||||
|
||||
echo "Linking From $CURRENT_DIRECTORY"
|
||||
|
||||
function doIt() {
|
||||
rsync --exclude "setup.sh" --exclude "Monaco-Powerline.otf" --exclude "web_start.sh" \
|
||||
--exclude "oh-my-zsh" --exclude "tmux-powerline" --exclude ".git/" \
|
||||
--exclude ".DS_Store" --exclude "bootstrap.sh" --exclude "README.md" \
|
||||
--exclude "requirements.txt" --exclude "more_python.txt" \
|
||||
-av . ~
|
||||
[[ -a ~/.dotfiles-backups ]] || mkdir ~/.dotfiles-backups
|
||||
exclude_list="setup.sh Monaco-Powerline.otf web_start.sh oh-my-zsh tmux-powerline .git .gitmodules .DS_store bootstrap.sh README.md more_python.txt . .. requirements.txt"
|
||||
|
||||
for i in .*; do
|
||||
if ! [ -z ${i/*.swp/} ] && ! [[ $exclude_list =~ $i ]]
|
||||
then
|
||||
[[ -a ~/$i ]] && mv ~/$i ~/.dotfiles-backups/$i
|
||||
ln -si $CURRENT_DIRECTORY/$i ~/$i
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
if [ "$1" == "--force" -o "$1" == "-f" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user