Created
July 5, 2017 07:53
-
-
Save patroza/328caba17e98bf14e38eccc447fd80c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
command=`basename "$0"` | |
run-windows-command "$command" "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
command=`basename "$0"` | |
run-windows-command "$command" "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
command="$1" | |
commands="chcp 437" | |
found="" | |
windowsfound="" | |
upsearch () { | |
slashes=${PWD//[^\/]/} | |
directory="$PWD" | |
windowsdirectory=directory | |
for (( n=${#slashes}; n>0; --n )) | |
do | |
test -e "$directory/.envrc" && windowsfound="$windowsdirectory" && found="$directory" && return | |
windowsdirectory="..\\" | |
directory="$directory/.." | |
done | |
} | |
upsearch | |
if [ "$found" = "$PWD" ]; then | |
found="." | |
windowsfound="." | |
fi | |
if [ "$found" ]; then | |
sed -e 's/export/set/g' $found/.envrc | sed 's/#/REM/g' | sed "s/'//g" > "$found/.env.bat" | |
commands+=" && $windowsfound\.env.bat" | |
fi | |
commands+=" && " | |
commands+=$command | |
commands+=" ${@:2}" | |
echo $commands | |
/mnt/c/Windows/System32/cmd.exe /c $commands |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment