Skip to content

Conversation

@RafaelJohn9
Copy link
Member

Description

This PR introduces user control over colored output in preview commands across multiple subcommands (gitignore, issue, pr, and license). Specifically:

  • Adds a --no-color CLI flag to all preview subcommands to allow disabling syntax highlighting.
  • When --no-color is used, raw template content is printed without ANSI escape sequences, ensuring clean output in non-ANSI terminals (e.g., legacy Windows consoles) or when piping to files.
  • Maintains existing highlighted output by default for users in modern terminals.

This change improves compatibility and usability in restricted or automated environments while preserving the enhanced visual experience for interactive users.

Type of Change

  • New feature (non-breaking change that adds functionality)

How Has This Been Tested?

  • Manually tested all affected preview commands (gitcraft gitignore preview, gitcraft issue preview, etc.) with and without the --no-color flag:
    • Verified syntax highlighting appears normally by default.
    • Confirmed that --no-color prints plain text without escape sequences.
    • Tested in both modern terminals (Windows Terminal, iTerm2) and simulated non-ANSI environments.
  • Ensured existing integration tests still pass (no behavioral change without the flag).

Checklist

  • My code follows the project's coding style guidelines
  • 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 applicable)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works (manual testing suffices for CLI flag)
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Additional Context

This change aligns with terminal best practices by respecting user preference for plain output and improving robustness in CI/scripts or legacy terminals. Future work could include auto-detection of terminal color support (e.g., via NO_COLOR env var), but this explicit flag provides immediate value with minimal complexity.

…mplate repo URL

- Updated GITHUB_RAW_BASE to point to Byte-Barn/gitcraft instead of rafaeljohn9/gitcraft
- Added retry logic with exponential backoff (max 3 attempts) to fetch_content and fetch_json
- Improved error messages to include HTTP status codes and reasons
- Adjusted integration test assertions to match new error message format ("Failed" vs "Request failed")
- Added --no-color option to preview subcommands for gitignore, issue, license, and PR templates
- Updated preview functions to accept no_color flag and fall back to plain println! when set
- Ensures compatibility with non-ANSI terminals and respects user preference for plain output
…ode .

Signed-off-by: rafaeljohn9 <rafaeljohb@gmail.com>
Signed-off-by: rafaeljohn9 <rafaeljohb@gmail.com>
@RafaelJohn9 RafaelJohn9 merged commit aeb744d into main Dec 28, 2025
2 checks passed
@RafaelJohn9 RafaelJohn9 deleted the feat/fetcher-retry-and-repo-update branch December 28, 2025 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants