diff options
author | ache <ache@ache.one> | 2018-01-28 03:47:15 +0100 |
---|---|---|
committer | ache <ache@ache.one> | 2018-01-28 03:47:15 +0100 |
commit | ce9c927d72cfa805631601f716ede30306bfc72b (patch) | |
tree | 026a448d72b0ce5620283254b137b0fbe6e792a6 /functions | |
parent | Update git alias features (diff) | |
parent | Better sec (diff) |
End the merge
Diffstat (limited to 'functions')
-rw-r--r-- | functions/fish_prompt.fish | 14 | ||||
-rw-r--r-- | functions/sec.fish | 9 |
2 files changed, 16 insertions, 7 deletions
diff --git a/functions/fish_prompt.fish b/functions/fish_prompt.fish index 180359d..b66528a 100644 --- a/functions/fish_prompt.fish +++ b/functions/fish_prompt.fish @@ -129,13 +129,15 @@ function prompt_shlv -d "Display level shell" end function prompt_todo -d "Display todo" - set all (todo | wc -l) - set chkd (todo checked | wc -l) - set td (math "$all-$chkd") + if which todo ^ /dev/null > /dev/null + set all (todo | wc -l) + set chkd (todo checked | wc -l) + set td (math "$all-$chkd") - if [ $all -gt 0 ] - prompt_segment 5C5C5C blue "$td/$all" - end + if [ $all -gt 0 ] + prompt_segment 5C5C5C blue "$td/$all" + end + end end diff --git a/functions/sec.fish b/functions/sec.fish index 8a2b842..abf5edc 100644 --- a/functions/sec.fish +++ b/functions/sec.fish @@ -1 +1,8 @@ -alias sec='ssh achessh@37.59.109.240 -p 21 -D 8886 -fN' +function sec + set t (lsof -c ssh -i :8886 -a -Fp | grep "^p" | head -n 1 | cut -c 2-) + if [ -n "$t" -a "$t" != " +" ] + kill $t + end + ssh achessh@37.59.109.240 -p 21 -D 8886 -fN +end |