Open rickysarraf opened 2 months ago
The below script that kubie
generates, when sourced (see logs further below), is the cause of the trouble.
@ cat /tmp/kubie-xonshrc1ChrXE.xsh
# https://xon.sh/xonshrc.html
from pathlib import Path
files = [
"/etc/xonshrc",
"~/.xonshrc",
"~/.config/xonsh/rc.xsh",
]
for file in files:
if Path(file).is_file():
source @(file)
if Path("~/.config/xonsh/rc.d").is_dir():
for file in path.glob('*.xsh'):
source @(file)
@events.on_precommand
def __kubie_cmd_pre_exec__(cmd):
$KUBECONFIG = $KUBIE_KUBECONFIG
$KUBIE_PROMPT='[\033[31m$(/home/rrs/bin/kubie info ctx)\033[0m|\033[32m$(/home/rrs/bin/kubie info ns)\033[0m]'
import re
# Fanciful prompt-command replacement as xonsh forces the use of PROMPT_FIELDS
for match in re.finditer(r'\$\(([^)]*)\)', $KUBIE_PROMPT):
command = match.group(1)
name = command.split().pop()
$PROMPT_FIELDS[name] = evalx(f'lambda: $({command}).strip()')
$KUBIE_PROMPT = $KUBIE_PROMPT.replace(f'$({command})', '{' + name + '}')
if $KUBIE_XONSH_USE_RIGHT_PROMPT == "1":
$RIGHT_PROMPT = $KUBIE_PROMPT + $RIGHT_PROMPT
else:
$PROMPT = $KUBIE_PROMPT + $PROMPT
del $KUBIE_PROMPT
@ source @(file)
Exception in {'cls': 'ProcProxy', 'name': None, 'func': FuncAlias({'name': 'source', 'func': 'source_alias', '__xonsh_threadable__': False, 'return_what': 'result'}), 'alias': 'source', 'pid': 1159896}
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/procs/proxies.py", line 784, in wait
r = run_with_partial_args(
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/xonsh/cli_utils.py", line 381, in run_with_partial_args
return func(**kwargs)
^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/xonsh/aliases.py", line 95, in __call__
return run_alias_by_params(
^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/xonsh/aliases.py", line 555, in run_alias_by_params
return func(**kwargs)
^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/xonsh/aliases.py", line 765, in source_alias
raise RuntimeError(
RuntimeError: must source at least one file, ~/.xonshrc does not exist.
If I source my ~/.xonshrc as the very first step after kubie ctx
, then I don't run into any problems.
When I reported the issue, it was just an observation that xontribs were missing. But now, given that it doesn't source the ~/.xonshrc as well, it hinders in my exceptional config.
This is the current workaround.
@ kubie ctx
rrs@priyasi ~ @ xontrib list [cs00114-we-01-aks|default]
abbrevs not-loaded
autojump not-loaded
coreutils not-loaded
fzf-widgets not-loaded
hist_navigator not-loaded
output_search not-loaded
powerline_binding not-loaded
sh not-loaded
term_integration not-loaded
rrs@priyasi ~ @ source ~/.xonshrc [cs00114-we-01-aks|default]
Loaded function prompt: stock_prompt
♒︎ 20:34:49 rrs@priyasi ~ [cs00114-we-01-aks|default ]
@ xontrib list
abbrevs loaded manual
autojump loaded manual
coreutils loaded manual
fzf-widgets loaded manual
hist_navigator not-loaded
output_search loaded manual
powerline_binding not-loaded
sh loaded manual
term_integration loaded manual
⛢ 20:34:54 rrs@priyasi ~ [cs00114-we-01-aks|default]
@
I have xonsh installed and configured as my user shell, in just my terminal config (kitty).
I also have
xonsh
specified in mykubie
config like:On my standard shell prompt, I have:
while inside
kubie ctx
, I have:I guess this is because
kubie
didn't initialize~/.xonshrc
. It would also imply that no history is saved to the xonsh history backend.I have:
And: