From: Ian Kelling Date: Sat, 27 Aug 2016 19:41:33 +0000 (-0700) Subject: various fixes X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=commitdiff_plain;h=d77584647b535c33bc1044cd2f8f18ad24cca813 various fixes --- diff --git a/.bashrc b/.bashrc index 3dc94d4..912b678 100644 --- a/.bashrc +++ b/.bashrc @@ -210,15 +210,14 @@ C_DEFAULT_DIR=/a ## include files ### ################### -for _x in /a/bin/distro-functions/src/* /a/bin/*/*-function?(s); do +for _x in /a/bin/distro-functions/src/* /a/bin/!(githtml)/*-function?(s); do source "$_x" done unset _x # so I can share my bashrc -for x in /a/bin/bash_unpublished/*; do source $x; done +for x in /a/bin/bash_unpublished/!(.#*); do source $x; done source $(dirname $(readlink -f $BASH_SOURCE))/path_add-function source /a/bin/log-quiet/logq-function -source /a/bin/log-quiet/log-once-function path_add /a/exe path_add --ifexists --end /a/opt/adt-bundle*/tools /a/opt/adt-bundle*/platform-tools # todo, these need to be renamed to be less generic. @@ -579,6 +578,9 @@ rename-test() { return 0 } +feh() { + command feh -FzZ "$@" +} funce() { # like -e for functions. returns on error. @@ -629,14 +631,25 @@ git_empty_branch() { # start an empty git branch. carefull, it deletes untracked git clean -fdx } +gitroot() { + local help="Usage: gitroot [--help] +Print the full path to the root of the current git repo + +Handles being within a .git directory, unlike git rev-parse --show-toplevel, +and works in older versions of git which did not have that." + if [[ $1 == --help ]]; then + echo "$help" + return + fi + local p=$(git rev-parse --git-dir) || { echo "error: not in a git repo" ; return 1; } + [[ $p != /* ]] && p=$PWD + echo "${p%%/.git}" +} + gr() { grep -iIP --color=auto "$@" } - - - - grr() { if [[ ${#@} == 1 ]]; then grep -riIP --color=auto "$@" . @@ -842,7 +855,7 @@ whatismyip() { pubip; } pwgen() { - apg -s -m 10 -x 14 -t + apg -m 12 -x 16 -t } @@ -891,7 +904,8 @@ rlu() { # [OPTS] HOST PATH } -rspicy() { # HOST DOMAIN +rspicy() { # usage: HOST DOMAIN + # connect to spice vm remote host. use vspicy for local host local port=$(ssh $1<