From 5ccd4c4d57f2640277e831fbfd62b5e5d6a40c23 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 29 May 2019 15:19:03 +0100 Subject: [PATCH] blame: Print the filename with blame #last In principle we could have got this from "git blame" but (1) that makes parsing this more annoying and (2) by rights this should come from the fish cfg so that it can be a display name at some point. The main effect is to print something like: 13:41 Modified flirts 2011-05-31: new fish from Alice rather than: 13:41 Modified 2011-05-31: new fish from Alice I have not taken the trouble to touch the three open-coded special cases for blame #trouts etc. I thought that was beyond the call of duty. In those cases it will print: 13:41 Modified fish? 2011-05-31: new fish from Alice Signed-off-by: Ian Jackson --- commands.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands.py b/commands.py index 8cc34f0..964dacf 100755 --- a/commands.py +++ b/commands.py @@ -323,6 +323,7 @@ def blameq(bot,cmd,nick,conn,public,fish,cfgs): bot.automsg(public,nick,"Who or what do you want to blame?") return cwhat=' '.join(clist[2:]) + kindsfile = "fish?" if clist[1]=="#last": if fish.last_cfg is None: bot.automsg(public,nick,"Nothing") @@ -344,7 +345,7 @@ def blameq(bot,cmd,nick,conn,public,fish,cfgs): if len(ans[0])==1: bot.automsg(public,nick,ans[0]) else: - bot.automsg(public,nick,"Modified %s: %s" % (ans[0][2].isoformat(),ans[0][1])) + bot.automsg(public,nick,"Modified %s %s: %s" % (kindsfile, ans[0][2].isoformat(),ans[0][1])) elif len(ans)>4: bot.automsg(public,nick,"I found %d matches, which is too many. Please be more specific!" % (len(ans)) ) else: @@ -352,7 +353,7 @@ def blameq(bot,cmd,nick,conn,public,fish,cfgs): if len(a)==1: bot.automsg(public,nick,a) else: - bot.automsg(public,nick,"'%s' modified on %s: %s" % (a[0],a[2].isoformat(),a[1])) + bot.automsg(public,nick,"%s '%s' modified on %s: %s" % (kindsfile, a[0],a[2].isoformat(),a[1])) ### say to msg/channel def sayq(bot, cmd, nick, conn, public): -- 2.30.2