diff options
-rw-r--r-- | alot/helper.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/alot/helper.py b/alot/helper.py index 3e5e9dce..ad605acb 100644 --- a/alot/helper.py +++ b/alot/helper.py @@ -24,6 +24,21 @@ import StringIO import logging +def split_commandline(s, comments=False, posix=True): + """ + splits semi-colon separated commandlines + """ + # encode s to utf-8 for shlex + if isinstance(s, unicode): + s = s.encode('utf-8') + lex = shlex.shlex(s, posix=posix) + lex.whitespace_split = True + lex.whitespace = ';' + if not comments: + lex.commenters = '' + return list(lex) + + def split_commandstring(cmdstring): """ split command string into a list of strings to pass on to subprocess.Popen |