Skip to content

Commit

Permalink
change .version output slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
TicClick committed Apr 29, 2021
1 parent d3b45ad commit 18e8beb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions librarian/discord/cogs/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async def show_version(self, ctx: types.Context, *args):
.version
"""

rc, head = await self.run_command(["git", "log", "-1", "--pretty=format:%H %cs"])
rc, head = await self.run_command(["git", "log", "-1", "--pretty=format:%h %cs"])
if rc == 0:
commit, date = head.split()
rc, tags = await self.run_command(["git", "tag", "--points-at", commit])
Expand All @@ -99,8 +99,5 @@ async def show_version(self, ctx: types.Context, *args):
return await ctx.message.channel.send(content="unknown version (failed to run `git log`)")

return await ctx.message.channel.send(
content=formatters.codewrap([
f"tag: {tag}",
f"last commit: {commit} ({date})"
])
content=formatters.codewrap(f"tag: {tag} (commit {commit} from {date})")
)
2 changes: 1 addition & 1 deletion tests/discord/cogs/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ def side_effect(*command, **kws):
await system_cog.show_version(ctx)

content = ctx.kwargs()["content"]
assert content == "```\ntag: {}\nlast commit: 1234abcd (2021-04-16)\n```".format(
assert content == "```\ntag: {} (commit 1234abcd from 2021-04-16)\n```".format(
expected_tag
)

0 comments on commit 18e8beb

Please # to comment.