tab completion finds items in other directories instead of local
find/grep from tutorial page (DONE)
Tutorial: Programmable Tab-Completion
!(), ![], $(), $[]this is subp.py:
# ------------------------------------------
#
print("plain date")
date
print("bang sq date")
![date]
print("=============")
print("![date} >>>> bang sq: output to stdout, rc is value struct, but not iterable")
rc = ![date]
print_cmdout(rc)
print("$[date] >>>> dollar sq: output to stdout, rc is none")
rc = $[date]
print("rc=", rc)
# ------------------------------
print("!(date) >>>> bang paren: output to variable (not stdout), value is cmd struct and is iterable")
try:
if $OS.startswith("Windows"): # we must be on cygwin
$THREAD_SUBPROCS=True
except:
pass
rc = !(printenv)
print("If you iterate over the CommandPipeline object, it will yield lines of its output.")
print("NEED to explicitly set THREAD_SUBPROCS on cygwin")
print("len=", len(rc))
print("type=", type(rc))
for rr in rc:
print(" rr=", rr)
print_cmdout(rc)
print("---")
try:
if $OS.startswith("Windows"): # we must be on cygwin
$THREAD_SUBPROCS=False
except:
pass
print("$(date) >>>> dollar paren: output to variable (not stdout), no rc or struct")
rc = $(date)
print("rc=", rc)
Captured Subprocess with $() and !()
Uncaptured Subprocess with $[] and ![]
todo: redirection
1) plain unix command:
ls: xonsh: subprocess mode: permission denied: ls
2) invalid command
$ nonsense
xonsh: For full traceback set: $XONSH_SHOW_TRACEBACK = True
xonsh: subprocess mode: command not found: nonsense
3) full path to cygwin cmd:
$ /usr/bin/ls
from_git notes.txt
<terminal hangs>
4) full path with .exe:
wendell@wwtlaptop ~/xonsh_testing $ /usr/bin/ls.exe
from_git notes.txt
<terminal hangs>
attempts to fix:
> pip3.7 install pyreadline
...
>>> import pyreadline
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/site-packages/pyreadline/__init__.py", line 12, in <module>
from . import logger, clipboard, lineeditor, modes, console
File "/usr/lib/python3.7/site-packages/pyreadline/clipboard/__init__.py", line 13, in <module>
from .win32_clipboard import GetClipboardText, SetClipboardText
File "/usr/lib/python3.7/site-packages/pyreadline/clipboard/win32_clipboard.py", line 37, in <module>
import ctypes.wintypes as wintypes
File "/usr/lib/python3.7/ctypes/wintypes.py", line 20, in <module>
class VARIANT_BOOL(ctypes._SimpleCData):
ValueError: _type_ 'v' not supported
my answer on gitter (https://gitter.im/xonsh/xonsh):
Anthony Scopatz @scopatz 00:15
Hmm that is weird @wendellwt - we used to have someone who paid closer attention to cygwin. We are happy to get error reports & pull requests
initial clone:
> cd xonsh_testing/from_git/
> git clone https://github.com/xonsh/xonsh.git
later:
> cd xonsh/
> git pull
EDIT as needed, then:
> python3.7 setup.py build
...
copying xonsh/prompt/__init__.py -> build/lib/xonsh/prompt
copying xonsh/dev.githash -> build/lib/xonsh
running build_scripts
> python3.7 setup.py install
...
Installing xonsh script to /usr/bin
Installing xonsh-cat script to /usr/bin
and finally:
> xonsh
Welcome to the xonsh shell (0.9.21.dev9.dev9.dev12.dev26.dev26)
~ Piggy glanced nervously into hell and cradled the xonsh ~
xonfig tutorial -> Launch the tutorial in the browser
xonfig web -> Run the configuration tool in the browser and claim your shell
(Note: Run the configuration tool or create a ~/.xonshrc file to suppress the welcome screen)
wendell@wwtlaptop ~/xonsh_testing/from_git/xonsh $
but then...???
edit near line 753:
> vim xonsh/xonfig.py
("{{INTENSE_WHITE}}Welcome-wt2 to the xonsh shell ({version}){{NO_COLOR}}", "^", " "),
> python3.7 setup.py build
> python3.7 setup.py install
ok, at least that change shows up...
it appears that edits to xonsh/xonfig.py show up
in xonsh/__amalgam__.py
and /build/lib/xonsh/__amalgam__.py
hmm...
FILES EDITED:
xonsh/xonfig.pyxonsh/shell.pyxonsh/readline_shell.py