Skip to content

feat: add --no-color flag for plain text output - #21

Open
Priyanka-cmd23 wants to merge 1 commit into
Dev9269:mainfrom
Priyanka-cmd23:feat/no-color-flag
Open

feat: add --no-color flag for plain text output#21
Priyanka-cmd23 wants to merge 1 commit into
Dev9269:mainfrom
Priyanka-cmd23:feat/no-color-flag

Conversation

@Priyanka-cmd23

Copy link
Copy Markdown

Summary

Adds a --no-color\ CLI flag that disables ANSI color codes from all output. Useful for:

  • Piping output to files without escape sequences
  • Running in CI/automated environments
  • Users who prefer plain terminal output

Changes

  • \main.py: Added --no-color\ argument to parser; sets \Formatter.no_color = True\ in main()
  • \utils/formatter.py: \ ormat_text()\ returns plain text immediately when
    o_color\ is True
  • \ ests/test_comprehensive.py: Added 4 unit tests in \TestFormatter\ class

Testing

\
python -m unittest tests.test_comprehensive.TestFormatter -v

All 4 tests pass

Without flag (default - colors present)

python main.py --version

With flag (plain text - no ANSI codes)

python main.py --version --no-color
\\

Closes #15

Implements a --no-color CLI flag that disables ANSI color codes
in all output. When set, Formatter.strip_color = True causes
format_text() to return plain text without escape sequences.

Changes:
- Add --no-color argument to argument parser in main.py
- Handle flag in main() by setting Formatter.no_color = True
- Modify Formatter.format_text() to skip ANSI wrapping when no_color is True
- Add unit tests in TestFormatter class

Closes Dev9269#15
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.

feat: add --no-color flag for plain output

2 participants