diff options
author | Mattias Andrée <maandree@operamail.com> | 2012-10-29 04:29:32 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2012-10-29 04:29:32 +0100 |
commit | fac982f4ed2ee79d881181dfe6b8c438198eb884 (patch) | |
tree | 57454b8bc42e6f2f712b2f08e3db2e45728f619d | |
parent | gitignore update (diff) | |
download | auto-auto-complete-fac982f4ed2ee79d881181dfe6b8c438198eb884.tar.gz auto-auto-complete-fac982f4ed2ee79d881181dfe6b8c438198eb884.tar.bz2 auto-auto-complete-fac982f4ed2ee79d881181dfe6b8c438198eb884.tar.xz |
zsh correction
-rwxr-xr-x | auto-auto-complete.py | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/auto-auto-complete.py b/auto-auto-complete.py index 4722a0d..be101f4 100755 --- a/auto-auto-complete.py +++ b/auto-auto-complete.py @@ -634,18 +634,13 @@ class GeneratorZSH: functionType = function[0] function = function[1:] if functionType == 'verbatim': - suggestion += '(%s)' % (' '.join([verb(item) for item in function])) + suggestion += ' %s ' % (' '.join([verb(item) for item in function])) elif functionType == 'ls': filter = '' if len(function) > 1: filter = ' | grep -v \\/%s\\$ | grep %s\\$' % (function[1], function[1]) - suggestion += '$(ls -1 --color=no %s%s)' % (function[0], filter) - elif functionType == 'exec': - elem = makeexec(functionType, function) - elem = elem[4:] - elem = elem[:-3] - suggestion += elem - elif functionType in ('pipe', 'fullpipe', 'cat', 'and', 'or'): + suggestion += ' $(ls -1 --color=no %s%s) ' % (function[0], filter) + elif functionType in ('exec', 'pipe', 'fullpipe', 'cat', 'and', 'or'): suggestion += ('%s' if functionType == 'exec' else '$(%s)') % makeexec(functionType, function) elif functionType == 'calc': expression = [] @@ -654,9 +649,9 @@ class GeneratorZSH: expression.append(('%s' if item[0] == 'exec' else '$(%s)') % makeexec(item[0], item[1:])) else: expression.append(verb(item)) - suggestion += '$(( %s ))' % (' '.join(expression)) + suggestion += ' $(( %s )) ' % (' '.join(expression)) if len(suggestion) > 0: - suggestFunctions[name] = '"' + suggestion + '"' + suggestFunctions[name] = suggestion buf += '_opts=(\n' @@ -678,15 +673,15 @@ class GeneratorZSH: if 'desc' in item: buf += '"["%s"]"' % verb(' '.join(item['desc'])) if 'arg' in item: - buf += ':%s' % verb(' '.join(item['arg'])) + buf += '":%s"' % verb(' '.join(item['arg'])) elif options[0] in suggesters: - buf += ': ' + buf += '": "' if options[0] in suggesters: suggestion = suggestFunctions[suggesters[options[0]]] - buf += ':%s' % suggestion + buf += '":( %s )"' % suggestion buf += '\n' - buf += ' )\n_arguments "$_opts[@]"\n\n' + buf += ' )\n\n_arguments "$_opts[@]"\n\n' return buf |