Skip to content

Conversation

@electron271
Copy link
Member

@electron271 electron271 commented May 11, 2025

Description

closes #842
adds backslash to prevent discord list formatting and removes not needed newlines

Guidelines

  • My code follows the style guidelines of this project (formatted with Ruff)

  • I have performed a self-review of my own code

  • I have commented my code, particularly in hard-to-understand areas

  • I have made corresponding changes to the documentation if needed

  • My changes generate no new warnings

  • I have tested this change

  • Any dependent changes have been merged and published in downstream modules

  • I have added all appropriate labels to this PR

  • I have followed all of these guidelines.

How Has This Been Tested? (if applicable)

ran /tldr test

Screenshots (if applicable)

before and after
image
image

Additional Information

Please add any other information that is important to this PR.

Summary by Sourcery

Improve formatting of tldr command output to enhance readability and compatibility with Discord.

Bug Fixes:

  • Prevent Discord list formatting by escaping leading dashes in tldr output.
  • Remove unnecessary blank lines between list items and code blocks in tldr output.

@electron271 electron271 added this to the 0.1.0 milestone May 11, 2025
@electron271 electron271 requested a review from Copilot May 11, 2025 21:23
@electron271 electron271 self-assigned this May 11, 2025
@electron271 electron271 linked an issue May 11, 2025 that may be closed by this pull request
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented May 11, 2025

Reviewer's Guide

This pull request refactors the TLDR command output formatting by escaping leading dashes and removing superfluous newlines, ensuring better display in Discord and preventing unintended list formatting.

File-Level Changes

Change Details Files
Improved formatting of TLDR command output to prevent Discord list formatting and remove unnecessary newlines.
  • Escaped leading dashes in TLDR output lines to prevent Discord from interpreting them as lists.
  • Removed unnecessary blank lines between dash-prefixed lines and inline code blocks.
  • Replaced direct subprocess output return with post-processing logic for formatting.
tux/cogs/utility/tldr.py

Assessment against linked issues

Issue Objective Addressed Explanation
#842 Condense the TLDR pages by removing the space between the description and the command.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR condenses TLDR pages by removing unnecessary newlines and escaping leading dashes to prevent Discord list formatting issues. Key changes include invoking the subprocess for TLDR, processing the output to filter unwanted blank lines, and escaping dashes.

Comments suppressed due to low confidence (1)

tux/cogs/utility/tldr.py:130

  • [nitpick] Consider enhancing the inline comment or extracting the condition into a well-named helper function to clarify the intent behind skipping blank lines between a dash and inline code.
if ( not raw.strip() and i > 0 and i < len(lines) - 1 and lines[i - 1].startswith("-") and lines[i + 1].startswith("`") ):

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @electron271 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@electron271 electron271 merged commit a598bfd into main May 11, 2025
9 of 10 checks passed
@electron271 electron271 deleted the 842--condense-tldr-pages branch May 11, 2025 21:25
@trunk-io
Copy link

trunk-io bot commented May 12, 2025

⏱️ 4m total CI duration on this PR

Job Cumulative Duration Recent Runs
docker 2m 🟩
Analyze (python) 59s 🟩
Analyze (actions) 50s 🟩
pyright 38s 🟩
Ruff 19s 🟩

settingsfeedbackdocs ⋅ learn more about trunk.io

@electron271
Copy link
Member Author

@trunk-io a little late

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] - Condense TLDR pages

2 participants