From: patrick nsukami Date: Thu, 18 Dec 2014 21:22:35 +0000 (+0000) Subject: updated the function I use to go to venv, can be better-ized. added a function to... X-Git-Url: https://git.nskm.xyz/?p=dotfiles;a=commitdiff_plain;h=4453b60e0eeada898b5b6ab2f3995926c7636f56 updated the function I use to go to venv, can be better-ized. added a function to send text to clipboard --- diff --git a/.bash_function b/.bash_function index 7573006..f66e66a 100644 --- a/.bash_function +++ b/.bash_function @@ -2,6 +2,11 @@ # my weird function file # lots of this coming from http://www.kfirlavi.com/blog/2012/11/14/defensive-bash-programming +my_copy_to_clipboard() { + local filecontent=$1 + [ -f $file ] && xclip -sel clip < $filecontent +} + my_usage() { cat <<-EOF @@ -87,15 +92,17 @@ not_begin_by () { grep -v "^"$by } -my_venv_list(){ +my_list_venv(){ ls $HOME"/envs" } -my_venv_goto() { +my_goto_venv() { local dir=$1 local env=$HOME"/envs/"$dir"/source/" - cd $env - source activate + #if source dir not exists, create & cd + [ -d $env ] && cd $env || mkdircd -p $env + # activate virtualenv + source $HOME"/envs/"$dir"/bin/activate" } # Taken from http://aaroncrane.co.uk/2009/03/git_branch_prompt/