Skip to content

Commit 23f7e2b

Browse files
authored
Merge pull request #10 from psuedomagi/main
Fixed issue where xonsh returns string representation of shell list
2 parents 94ecee2 + 18efbd8 commit 23f7e2b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

xontrib/sh.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,20 @@
22

33
from shutil import which
44

5-
_shells = list(__xonsh__.env.get('XONTRIB_SH_SHELLS', ['bash', 'sh']))
5+
def parse_shells_env(shells_env):
6+
if isinstance(shells_env, str):
7+
if '[' in shells_env: # string representation of a list
8+
return shells_env.strip('[]').replace("'", "").split(',')
9+
return [shells_env.replace("'", "")] #single shell
10+
return list(shells_env)
11+
12+
_shells = parse_shells_env(__xonsh__.env.get('XONTRIB_SH_SHELLS', ['bash', 'sh']))
613
_bash_win = 'bash.exe'
714
_installed_shells = []
815
_match_first_char = __xonsh__.env.get('XONTRIB_SH_MATCHFIRST', True)
916
_match_full_name = __xonsh__.env.get('XONTRIB_SH_MATCHFULL', True)
1017
_shells_without_syntax_check = ['pwsh', 'powershell', 'cmd', 'nu']
1118

12-
1319
@events.on_transform_command
1420
def onepath(cmd, **kw):
1521
cmd_flag = '-c' # *sh flag to execute the specified commands, change to '/C' for cmd

0 commit comments

Comments
 (0)