diff options
Diffstat (limited to 'src/common.py')
-rw-r--r-- | src/common.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/common.py b/src/common.py index 141b67be..f910892d 100644 --- a/src/common.py +++ b/src/common.py @@ -41,6 +41,7 @@ import subprocess import curses import sys import time +import shlex ROOM_STATE_NONE = 11 ROOM_STATE_CURRENT = 10 @@ -192,3 +193,15 @@ def datetime_tuple(timestamp): dst = timedelta(seconds=time.altzone) ret -= dst return ret + +def shell_split(string): + sh = shlex.shlex(string, posix=True) + ret = list() + try: + w = sh.get_token() + while w: + ret.append(w) + w = sh.get_token() + return ret + except ValueError: + return string.split() |