mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-17 04:29:14 +02:00
fix(aliases): preserve trailing double quote in \als\ output
strip('\'"\n ') was stripping double quotes from both ends of the alias
value, so an alias like now='date +"%T"' was displayed as `date +"%T`
(missing the closing double quote). Fix by stripping only outer matching
quote pairs rather than all quote characters from both ends.
Fixes #13637
This commit is contained in:
parent
887a864aba
commit
b08b350ee9
2 changed files with 58 additions and 1 deletions
|
|
@ -6,7 +6,9 @@ import argparse
|
|||
|
||||
def parse(line):
|
||||
left = line[0:line.find('=')].strip()
|
||||
right = line[line.find('=')+1:].strip('\'"\n ')
|
||||
right = line[line.find('=')+1:].strip('\n ')
|
||||
if len(right) >= 2 and right[0] == right[-1] and right[0] in ("'", '"'):
|
||||
right = right[1:-1]
|
||||
try:
|
||||
cmd = next(part for part in right.split() if len([char for char in '=<>' if char in part])==0)
|
||||
except StopIteration:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue