config/shell: reformat to tabs
This commit is contained in:
parent
6c0fb2482e
commit
49179953f6
|
@ -14,11 +14,11 @@ alias info='info --vi-keys'
|
|||
xdh="$XDG_DATA_HOME"
|
||||
xch="$XDG_CONFIG_HOME"
|
||||
if test -d "$DATA"; then
|
||||
da=$(cd $DATA/_* && pwd)
|
||||
d1=$(cd $DATA/1* && pwd)
|
||||
d2=$(cd $DATA/2* && pwd)
|
||||
d3=$(cd $DATA/3* && pwd)
|
||||
d4=$(cd $DATA/4* && pwd)
|
||||
da=$(cd $DATA/_* && pwd)
|
||||
d1=$(cd $DATA/1* && pwd)
|
||||
d2=$(cd $DATA/2* && pwd)
|
||||
d3=$(cd $DATA/3* && pwd)
|
||||
d4=$(cd $DATA/4* && pwd)
|
||||
fi 2>/dev/null
|
||||
|
||||
ulimit -c unlimited # Enable core dumps
|
||||
|
@ -27,11 +27,11 @@ which lsb_release >/dev/null && export DIST=$(lsb_release --id | cut -d' ' -f2)
|
|||
|
||||
unalias rd 2>/dev/null
|
||||
rd() {
|
||||
while test $# -gt 0
|
||||
do
|
||||
test -d "$1" && find "$1" -maxdepth 1 -type d -empty -printf "Removing %p\n" -delete || rm -iv "$@"
|
||||
shift
|
||||
done
|
||||
while test $# -gt 0
|
||||
do
|
||||
test -d "$1" && find "$1" -maxdepth 1 -type d -empty -printf "Removing %p\n" -delete || rm -iv "$@"
|
||||
shift
|
||||
done
|
||||
}
|
||||
rr() { mv "$@" /tmp }
|
||||
|
||||
|
@ -43,8 +43,8 @@ alias jnc='jn -contains'
|
|||
|
||||
# like "which", but shows contents if it resolves to a file
|
||||
wh() {
|
||||
res=$(which "$@")
|
||||
test -r "$res" && b --plain "$res" || echo "$res"
|
||||
res=$(which "$@")
|
||||
test -r "$res" && b --plain "$res" || echo "$res"
|
||||
}
|
||||
|
||||
alias logoff="loginctl terminate-user $USER"
|
||||
|
@ -91,17 +91,17 @@ edshell() {
|
|||
}
|
||||
|
||||
edbin() {
|
||||
file="$(f=$(which $1) && test -f "$f" && echo $f || echo "$HOME/.local/bin/scripts/$1")"
|
||||
edit "$file"
|
||||
case "$file" in ($HOME*) yadm add "$file";; esac
|
||||
file="$(f=$(which $1) && test -f "$f" && echo $f || echo "$HOME/.local/bin/scripts/$1")"
|
||||
edit "$file"
|
||||
case "$file" in ($HOME*) yadm add "$file";; esac
|
||||
}
|
||||
|
||||
alias l="ls -l --almost-all --human-readable --group-directories-first --file-type"
|
||||
cd() {
|
||||
test ! -d "$1" && test $# -eq 1 && dir=$(f --glob "$1*" "$DATA" --maxdepth 2 --type d --max-results 1) &&
|
||||
test -n "$dir" && cd "$dir" && return
|
||||
builtin cd $1 &&
|
||||
command ls --file-type --group-directories-first --color=always --format=vertical -w $COLUMNS | head -3
|
||||
test ! -d "$1" && test $# -eq 1 && dir=$(f --glob "$1*" "$DATA" --maxdepth 2 --type d --max-results 1) &&
|
||||
test -n "$dir" && cd "$dir" && return
|
||||
builtin cd $1 &&
|
||||
command ls --file-type --group-directories-first --color=always --format=vertical -w $COLUMNS | head -3
|
||||
}
|
||||
|
||||
swap() {
|
||||
|
@ -112,13 +112,14 @@ swap() {
|
|||
|
||||
# Task management & time tracking
|
||||
t() {
|
||||
if test "$#" -eq 0 && which tn >/dev/null
|
||||
then tn
|
||||
else if test "$1" = "do"
|
||||
then test "$2" -gt 0 2>/dev/null && task mod sched:today "${@:2}" || task add sched:today "${@:2}"
|
||||
else task "$@"
|
||||
fi
|
||||
fi
|
||||
if test "$#" -eq 0 && which tn >/dev/null
|
||||
then tn
|
||||
else
|
||||
if test "$1" = "do"
|
||||
then test "$2" -gt 0 2>/dev/null && task mod sched:today "${@:2}" || task add sched:today "${@:2}"
|
||||
else task "$@"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
alias tw='timew'
|
||||
|
@ -146,10 +147,10 @@ browse-unsafe() {
|
|||
}
|
||||
|
||||
xo() {
|
||||
while test $# -gt 0; do
|
||||
xdg-open "$1"
|
||||
shift
|
||||
done
|
||||
while test $# -gt 0; do
|
||||
xdg-open "$1"
|
||||
shift
|
||||
done
|
||||
}
|
||||
alias sqli='rlwrap sqlite3 -column -header -cmd .tables'
|
||||
__loci='locate --ignore-case --basename'
|
||||
|
@ -169,18 +170,18 @@ alias gdiff='git diff --word-diff=color --word-diff-regex=. --no-index'
|
|||
alias sc='sudo systemctl'
|
||||
alias sce='sudo systemctl enable --now'
|
||||
scs() {
|
||||
sudo systemctl status "*$1*"
|
||||
systemctl --user status "*$1*"
|
||||
sudo systemctl status "*$1*"
|
||||
systemctl --user status "*$1*"
|
||||
}
|
||||
alias scu='systemctl --user'
|
||||
alias scue='systemctl --user enable --now'
|
||||
|
||||
scb() {
|
||||
sudo systemctl stop -T "$1"
|
||||
systemctl --user stop -T "$1"
|
||||
read
|
||||
sudo systemctl start -T "$1"
|
||||
systemctl --user start -T "$1"
|
||||
sudo systemctl stop -T "$1"
|
||||
systemctl --user stop -T "$1"
|
||||
read
|
||||
sudo systemctl start -T "$1"
|
||||
systemctl --user start -T "$1"
|
||||
}
|
||||
|
||||
alias jcl='sudo SYSTEMD_LESS=FRKi journalctl --boot --no-hostname -e'
|
||||
|
@ -233,7 +234,7 @@ updateDeps() {
|
|||
done
|
||||
echo name $name depth $depth pattern $oldversion version $version
|
||||
find -maxdepth $depth -type f -name $name | while read f
|
||||
do echo $f
|
||||
do echo $f
|
||||
sed -i "s/\($pattern\)$oldversion/\1$version/gw /dev/stdout" $f
|
||||
done
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# A tool for managing multiple git projects quickly. Simply source this in your bashrc or zshrc.
|
||||
# This assumes a common directory that contains all projects. Subfolders are detected as well.
|
||||
# You can set $projects_dir before or after sourcing this script, or adjust it below.
|
||||
# The standard command I execute daily is "p status", it updates all projects and shows their status.
|
||||
# The regular command is "p status" to update all projects and show their status.
|
||||
|
||||
# Common root for all projects
|
||||
projects_dir=${projects_dir:-$DATA/4-incubator/dev}
|
||||
|
@ -13,14 +13,14 @@ projects_subfolder_level=4
|
|||
# Lists all projects under $projects_dir or the current directory if that is a subfolder of $projects_dir and not a git repository.
|
||||
# This is done by searching for corresponding ".git" folders and then listing their parent directories via "dirname"
|
||||
listprojects() {
|
||||
if test "$1" = "--all"
|
||||
then find $projects_dir -mindepth 2 -maxdepth $projects_subfolder_level -type d -name ".git" | xargs dirname
|
||||
else
|
||||
if test "$(echo $PWD | grep $projects_dir/)" && ! git rev-parse --git-dir > /dev/null 2>&1
|
||||
then find $PWD -mindepth 2 -maxdepth $projects_subfolder_level -type d -name ".git" | xargs dirname 2> /dev/null || listprojects --all
|
||||
else find $projects_dir -mindepth 2 -maxdepth $projects_subfolder_level -type d -not -path "*_*" -name ".git" | xargs dirname
|
||||
fi
|
||||
fi
|
||||
if test "$1" = "--all"
|
||||
then find $projects_dir -mindepth 2 -maxdepth $projects_subfolder_level -type d -name ".git" | xargs dirname
|
||||
else
|
||||
if test "$(echo $PWD | grep $projects_dir/)" && ! git rev-parse --git-dir > /dev/null 2>&1
|
||||
then find $PWD -mindepth 2 -maxdepth $projects_subfolder_level -type d -name ".git" | xargs dirname 2> /dev/null || listprojects --all
|
||||
else find $projects_dir -mindepth 2 -maxdepth $projects_subfolder_level -type d -not -path "*_*" -name ".git" | xargs dirname
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Underline the project names
|
||||
|
@ -29,10 +29,11 @@ highlight() { echo "[4m$1[0m" }
|
|||
# Lists all projects and evaluates the given command.
|
||||
alias p=projects
|
||||
projects() {
|
||||
test "$1" = "--all" && all="$1" && shift
|
||||
test "$1" = "--all" && all="$1" && shift
|
||||
case $1 in
|
||||
"build")
|
||||
# Builds all found gradle projects in parallel and then prints the results in batches - WARNING: This is likely to considerably slow down your computer!
|
||||
# Builds all found gradle projects in parallel and then prints the results in batches
|
||||
# WARNING: This is likely to considerably slow down your computer!
|
||||
listprojects $all | while read d; do
|
||||
if test "$(find $d -maxdepth 1 -name "*gradle*")"; then
|
||||
builtin cd $d
|
||||
|
@ -73,7 +74,7 @@ projects() {
|
|||
test $behind -gt 0 && st+=("behind $behind")
|
||||
local stashes=$(git stash list | wc -l)
|
||||
test $stashes -gt 0 && st+=("stashed $stashes")
|
||||
test "$st" && name+=" [$(IFS=, eval 'JOINED="${st[*]}"' && echo $JOINED)]"
|
||||
test "$st" && name+=" [$(IFS=, eval 'JOINED="${st[*]}"' && echo $JOINED)]"
|
||||
highlight $(basename $d)
|
||||
eval "$com"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue