From 244c080d772adc0f903b3f9dd5bdfd788ec8efac Mon Sep 17 00:00:00 2001 From: glmdev Date: Wed, 28 Nov 2018 12:54:49 -0600 Subject: [PATCH] bash support --- README.md | 1 - do_what.bash | 3 +++ do_what.py | 8 ++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 do_what.bash diff --git a/README.md b/README.md index a2633d1..b22cfff 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,6 @@ This project is currently a work-in-progress. Only the fish shell is supported a ## TODO - Documentation/License - Installation & Generalization - - Bash Support - Zsh Support - Command Memory/Env Support - Double wh does an la, not ls diff --git a/do_what.bash b/do_what.bash new file mode 100644 index 0000000..3468ec2 --- /dev/null +++ b/do_what.bash @@ -0,0 +1,3 @@ +function wh { + source <(python3 /home/glmdev/Projects/do_what/do_what.py $*) +} diff --git a/do_what.py b/do_what.py index a335649..fdb4944 100644 --- a/do_what.py +++ b/do_what.py @@ -2,7 +2,8 @@ import sys import os import subprocess -shell="fish" +# supported values: fish, bash +shell="bash" print_file="cat" pretty_print_file="less -R" @@ -10,7 +11,10 @@ edit_file="vim" list_directory="ls --color=auto" def set_runtime_var(name, value, options=""): - print("set "+name+" "+options+" \""+value+"\"") + if ( shell == "fish" ): + print("set "+name+" "+options+" \""+value+"\"") + elif ( shell == "bash" ): + print("export "+name+"="+"\""+value+"\"") def is_binary_file(filepathname): textchars = bytearray([7,8,9,10,12,13,27]) + bytearray(range(0x20, 0x7f)) + bytearray(range(0x80, 0x100))