From b9c50e400f57272833586d94758125b736e1f8ad Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sat, 8 Sep 2018 21:34:54 -0700 Subject: [PATCH] Fix abbreviations in web_config --- share/tools/web_config/webconfig.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/share/tools/web_config/webconfig.py b/share/tools/web_config/webconfig.py index b8c0f8007..937838980 100755 --- a/share/tools/web_config/webconfig.py +++ b/share/tools/web_config/webconfig.py @@ -846,11 +846,15 @@ class FishConfigHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): return result def do_get_abbreviations(self): - out, err = run_fish_cmd('echo -n -s $fish_user_abbreviations\x1e') - - lines = (x for x in out.rstrip().split('\x1e')) - abbrs = (re.split('[ =]', x, maxsplit=1) for x in lines if x) - result = [{'word': x, 'phrase': y} for x, y in abbrs] + # Example abbreviation line: + # abbr -a -U -- ls 'ls -a' + result = [] + out, err = run_fish_cmd('abbr --show') + for line in out.rstrip().split('\n'): + if not line: continue + _, abbr = line.split(' -- ', 1) + word, phrase = abbr.split(' ', 1) + result.append({'word':word, 'phrase':phrase}) return result def do_remove_abbreviation(self, abbreviation):