diff options
author | kongr45gpen <electrovesta@gmail.com> | 2014-12-31 17:05:05 +0200 |
---|---|---|
committer | kongr45gpen <electrovesta@gmail.com> | 2014-12-31 17:05:05 +0200 |
commit | afdb8a96e0b4adb612560ad241f288c7761af73a (patch) | |
tree | 0a3924c9785e0872d707175cf44aee8fdecedc30 /local/utility.py | |
parent | d7e9c2b03f552193e2d8ccbcfc44987c659fc469 (diff) | |
download | supybot_github-afdb8a96e0b4adb612560ad241f288c7761af73a.tar.gz supybot_github-afdb8a96e0b4adb612560ad241f288c7761af73a.tar.bz2 supybot_github-afdb8a96e0b4adb612560ad241f288c7761af73a.zip |
Add support for different themes
Diffstat (limited to 'local/utility.py')
-rw-r--r-- | local/utility.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/local/utility.py b/local/utility.py index 1f73fbd..b7d99ee 100644 --- a/local/utility.py +++ b/local/utility.py @@ -40,10 +40,19 @@ def plural(number, s, p): return p return s -def maxLen(msg, maxn=400): +def maxLen(msg, maxn=400, splitLines=True): """Cut down a string if its longer than `maxn` chars""" - if len(msg) > maxn: - ret = "%s..." % (msg[0:(maxn-3)]) + + if splitLines is True: + lines = msg.splitlines() + line = lines[0] + else: + line = msg + + if len(line) > maxn: + ret = "%s..." % (line[0:(maxn-3)]) + elif splitLines is True and len(lines) > 1: + ret = "%s..." % (line) else: ret = msg return ret @@ -56,7 +65,7 @@ def colorAction(action): "failed", "errored", "failure", "still failing", "broken" ]: return ircutils.bold(ircutils.mircColor(action, "red")) - if action in [ "merged" ]: + if action in [ "assigned", "merged" ]: return ircutils.bold(ircutils.mircColor(action, "light blue")) if action in [ "reopened", "pending" ]: return ircutils.bold(ircutils.mircColor(action, "blue")) |