dolphingarlic/git-the-lines

Extrapolate and post filename and line of the snippet.

Al12rs opened this issue · 2 comments

Thanks for the nice bot, it helps when using discord as the main development discussion platform.

I wanted to propose the addition of the filename and displayed lines in the bot message, in a more readable way than what is contained in the link.

For example here
image
the bot doesn't currently give any context of where the lines are from and the users need to extrapolate it from the link, which makes it more difficult at a glance.

In comparison this is how github renders the link:

async def fetch_http(session, url, response_format="text", **kwargs):
"""Uses aiohttp to make http GET requests"""
async with session.get(url, **kwargs) as response:
if response_format == "text":
return await response.text()
elif response_format == "json":
return await response.json()

Regarding how to show the information, I was thinking of something simple like this:
image

Where the filename is in bold and the line number/numbers are in normal text.

I work on an opensource project with a pretty sizable codebase and being able to see at a glance which file is being snipped would be very helpful.
In my opinion the repository name isn't necessary since it's usually clear from the context or from the filename itself. In case it's needed the developer can still get the info from the link, although less conveniently. Also adding that would risk in my opinion cluttering the extracted information too much, reducing it's readability at a glance.

Thanks for the suggestion! I've implemented this feature in c1eab89. Let me know if anything breaks because of this

Nice, looks clean! Thank you very much!