-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add xonsh support #84
Conversation
Nice, thanks. In the other shells I've added hooks to constantly reset KUBECONFIG to the right value (the one in KUBIE_KUBECONFIG). This is done to avoid errors if someone or a tool does an |
Ah, good catch! Yep, I've added that functionality now. However, I'm only now realizing that the prompt doesn't actually get updated after initialization. I'll convert this to a draft until I figure that out. |
I tried your branch with xonsh, I got this error just after picking the context. I'm using Debian bullseye so the xonsh version is a tad behind, but not that much. simon@debian ~/projects/kubie hall-xonsh $ $XONSH_SHOW_TRACEBACK = True
simon@debian ~/projects/kubie hall-xonsh $ kubie ctx
xonsh: To log full traceback to a file set: $XONSH_TRACEBACK_LOGFILE = <filename>
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/xonsh/__amalgam__.py", line 17922, in xonsh_script_run_control
run_script_with_cache(filename, execer, ctx)
File "/usr/lib/python3/dist-packages/xonsh/__amalgam__.py", line 3214, in run_script_with_cache
ccode = compile_code(filename, code, execer, glb, loc, mode)
File "/usr/lib/python3/dist-packages/xonsh/__amalgam__.py", line 3173, in compile_code
ccode = execer.compile(code, glbs=glb, locs=loc, mode=mode, filename=filename)
File "/usr/lib/python3/dist-packages/xonsh/__amalgam__.py", line 21438, in compile
tree = self.parse(input, ctx, mode=mode, filename=filename, transform=transform)
File "/usr/lib/python3/dist-packages/xonsh/__amalgam__.py", line 21398, in parse
tree, input = self._parse_ctx_free(input, mode=mode, filename=filename)
File "/usr/lib/python3/dist-packages/xonsh/__amalgam__.py", line 21522, in _parse_ctx_free
tree = self.parser.parse(
File "/usr/lib/python3/dist-packages/xonsh/parsers/base.py", line 497, in parse
tree = self.parser.parse(input=s, lexer=self.lexer, debug=debug_level)
File "/usr/lib/python3/dist-packages/ply/yacc.py", line 333, in parse
return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
File "/usr/lib/python3/dist-packages/ply/yacc.py", line 1120, in parseopt_notrack
p.callable(pslice)
File "/usr/lib/python3/dist-packages/xonsh/parsers/base.py", line 2253, in p_atom_expr
p[0] = self.apply_trailers(p[1], p[2])
File "/usr/lib/python3/dist-packages/xonsh/parsers/base.py", line 2247, in apply_trailers
assert False
AssertionError
error running xonsh run control file '/tmp/kubie-xonshrcVUMSyd.xonsh':
simon@debian ~/projects/kubie hall-xonsh $ xonsh --version
xonsh/0.9.25 |
@@ -15,6 +16,7 @@ impl ShellKind { | |||
Some(match name { | |||
"bash" | "dash" => ShellKind::Bash, | |||
"fish" => ShellKind::Fish, | |||
"xonsh" | "python" => ShellKind::Xonsh, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's hope not too many shells are made with Python 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured we'd let them cross that bridge when they get here 😁 The alternative would probably be to, if python was detected, strip the interpreter and then reevaluate the remaining string as if it were the original command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we'll cross the bridge when we get to it
Code looks good to me. It's just a matter of ironing out a few bugs I think. |
Interesting. You're only one patch version behind me (on nixos 21.05). I just tried the appimage from xonsh's repo (the |
I tried installing xonsh 0.10.1 with pipx, |
It should update (prepend, by default) the prompt, yeah. print($PROMPT) Should have something like |
I start in a bash shell first, then do |
Hm, I did It does it at the 3rd to last line in the generated file:
|
Alright -- I think I've fixed the FROM debian:bullseye
RUN apt update && \
apt install -y \
cargo \
procps \
vim \
xonsh
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
COPY src src
RUN cargo install --path .
ENV PATH /root/.cargo/bin:$PATH
ENTRYPOINT xonsh then
and, once inside the container
For some reason, it didn't like the array index notation so I just replaced that with a call to |
These changes have been working pretty well on my end; let me know if there's something else that needs fixed/updated before it can be merged. |
Yeah, sorry. I was under the assumption that the bug I found was still there. |
I re-tested it and it looks good so I will merge it. |
Mostly straightforward changes; not a xonsh or rust expert but it works on my machine 😄 a few notes to help explain why I did things the way I did:
\e
color escapes (but works fine with\033
)PROMPT_FIELDS
dict.