create install mechanism
This commit is contained in:
parent
64ff921a36
commit
44fff79e61
@ -13,7 +13,7 @@ This project is currently a work-in-progress. Only the fish shell is supported a
|
||||
|
||||
## TODO
|
||||
- Documentation/License
|
||||
- Installation & Generalization
|
||||
- Uninstaller & Updater
|
||||
- Command Memory/Env Support
|
||||
- Double wh does an la, not ls
|
||||
- directory history for ls'ing back
|
||||
|
@ -1,3 +0,0 @@
|
||||
function wh {
|
||||
source <(python3 /home/glmdev/Projects/do_what/do_what.py $*)
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
function wh
|
||||
python3 /home/glmdev/Projects/do_what/do_what.py $argv | .
|
||||
end
|
@ -8,7 +8,12 @@ import json
|
||||
mime = magic.Magic(mime=True)
|
||||
|
||||
# supported values: fish, bash, zsh
|
||||
shell="fish"
|
||||
if ( 'DO_WHAT_SHELL' in os.environ ):
|
||||
shell=os.environ['DO_WHAT_SHELL']
|
||||
else:
|
||||
print("echo Shell type not set. To set up the environment, add the following line to your shell\\\'s init file:")
|
||||
print("echo dowhat {shell} \| .")
|
||||
exit()
|
||||
|
||||
# Defaults
|
||||
print_file="cat"
|
||||
|
16
do_what_aliaser.py
Normal file
16
do_what_aliaser.py
Normal file
@ -0,0 +1,16 @@
|
||||
import sys
|
||||
|
||||
if ( len(sys.argv) > 1 ):
|
||||
shell = sys.argv[1]
|
||||
if ( shell == "fish" ):
|
||||
print("function wh")
|
||||
print(" set -x DO_WHAT_SHELL fish")
|
||||
print(" python3 "+interpreter_location+" $argv | .")
|
||||
print("end")
|
||||
elif ( shell == "bash" or shell == "zsh" ):
|
||||
print("function wh {")
|
||||
print(" export DO_WHAT_SHELL="+shell)
|
||||
print(" source <(python3 "+interpreter_location+" $*)")
|
||||
print("}")
|
||||
else:
|
||||
print("No shell specified.")
|
18
install.sh
Executable file
18
install.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
INSTALL_DIR=$(readlink -f $1)
|
||||
|
||||
# Make the installation directory
|
||||
mkdir -p $INSTALL_DIR/do_what
|
||||
mkdir -p $INSTALL_DIR/bin
|
||||
|
||||
cp ./do_what.py $INSTALL_DIR/do_what/interpreter.py
|
||||
|
||||
echo "#!/usr/bin/env python3" > $INSTALL_DIR/do_what/dowhat
|
||||
echo "interpreter_location=\"$INSTALL_DIR/do_what/interpreter.py\"" >> $INSTALL_DIR/do_what/dowhat
|
||||
cat ./do_what_aliaser.py >> $INSTALL_DIR/do_what/dowhat
|
||||
|
||||
ln -s $INSTALL_DIR/do_what/dowhat $INSTALL_DIR/bin/dowhat
|
||||
chmod +x $INSTALL_DIR/do_what/dowhat
|
||||
|
||||
echo "End."
|
Loading…
Reference in New Issue
Block a user