From 4453b60e0eeada898b5b6ab2f3995926c7636f56 Mon Sep 17 00:00:00 2001 From: patrick nsukami Date: Thu, 18 Dec 2014 21:22:35 +0000 Subject: [PATCH] updated the function I use to go to venv, can be better-ized. added a function to send text to clipboard --- .bash_function | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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/ -- 2.17.1