Hello all, a very quick request -- really digging xonsh as my main shell and don't think I can go back.
What would be more helpful than anything if there were some "xonsh library" I could drop into my python scripts that would enable me to use $() and !(). I'm thinking of taking something like this:
#!/usr/bin/env xonsh
#myscript.xsh
dir1 = "~/mydir1"
dir2 = "~/mydir2"
dirlisting1 = $(ls @(dir1) -p | grep "/" -v).strip("\n").split("\n")
dirlisting2 = $(ls @(dir2) -p | grep "/" -v).strip("\n").split("\n")
parsed = [x for x in dirlisting1 if x not in dirlisting2]
fileexists = bool(!(test -e myfile).returncode == 0)
and turning it into something like this:
#!/usr/bin/env python3
#myscript.py
from xonsh import sh, shmore
dir1 = "~/mydir1"
dir2 = "~/mydir2"
dirlisting1 = sh('ls '+dir1+' -p | grep "/" -v').strip("\n").split("\n")
dirlisting2 = sh('ls '+dir2+' -p | grep "/" -v').strip("\n").split("\n")
parsed = [x for x in dirlisting1 if x not in dirlisting2]
fileexists = bool(shmore("test -e myfile").returncode == 0)
This would be fabulous! It would be quick to regex convert things this way.
FWIW, I haven't found any Python library nearly as useful as xonsh. In comparison, using things like Plumbum are just no fun at all.