Home
initial commit - onion-completion - bash-tab-completion for onion adresses HTML git clone git@kroovy.de:onion-completion DIR Log DIR Files DIR Refs DIR README --- DIR commit a5d83002005e495fcd9c70561bb55508f6cc751d HTML Author: kroovy <me@kroovy.de> Date: Wed, 13 Sep 2017 11:18:22 +0200 initial commit Diffstat: A README.md | 4 ++++ A bashrc | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 0 deletions(-) --- DIR diff --git a/README.md b/README.md @@ -0,0 +1,4 @@ +this snippet will add onion adress completion to your favourite program + +* works with bash +* needs a onion adress bookmark file DIR diff --git a/bashrc b/bashrc @@ -0,0 +1,28 @@ +# fancy onion completion + +# config +CMD_ALIAS="torified-sacc"; # feel free to pick something shorter +TORIFY_CMD="torsocks"; # may be "torify" on your system +BM_PATH="$HOME/.onion-bookmarks"; # one adress per line, (lynx needs "gopher://" prefix) +GPH_CLIENT="sacc"; + + +alias ${CMD_ALIAS}="${TORIFY_CMD} ${GPH_CLIENT}"; + +ONION_BOOKMARKS=""; + +for bookmark in $(cat ${BM_PATH}); +do + ONION_BOOKMARKS="$ONION_BOOKMARKS $bookmark"; +done; + +_onion_complete() +{ + local cur_word; + + cur_word="${COMP_WORDS[COMP_CWORD]}"; + + COMPREPLY=( $( compgen -W "$ONION_BOOKMARKS" -- "$cur_word" ) ); +} + +complete -F _onion_complete ${CMD_ALIAS};