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:
Green Orange 2026-04-06 00:25:35 +02:00
commit b08b350ee9
No known key found for this signature in database
2 changed files with 58 additions and 1 deletions

View file

@ -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: