Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fmt): Make printf working with colors. #6359

Closed

Conversation

keelii
Copy link

@keelii keelii commented Jan 24, 2025

printf is not working well with colors package.

➜  ent-std git:(master) ✗ cat test.ts  
import { printf } from "jsr:@std/fmt/printf";
import {underline} from "jsr:@std/fmt/colors";

printf("a: %7s|\n", underline("foo"))
printf("b: %7s|\n", underline("foo bar"))
➜  ent-std git:(master) ✗ deno run -A test.ts
a: foo|
b: foo bar|

Add stripAnsiCode in Printf.fmtString maybe solve this problem.

➜  std git:(feat/make_printf_working_with_colors) ✗ cat test.ts  
import {printf} from "./fmt/printf.ts";
import {underline} from "./fmt/colors.ts";

printf("a: %7s|\n", underline("foo"))
printf("b: %7s|\n", underline("foo bar"))
➜  std git:(feat/make_printf_working_with_colors) ✗ deno run -A test.ts
a:     foo|
b: foo bar|

@keelii keelii requested a review from kt3k as a code owner January 24, 2025 06:58
@CLAassistant
Copy link

CLAassistant commented Jan 24, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions github-actions bot added the fmt label Jan 24, 2025
Copy link

codecov bot commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.34%. Comparing base (6c96a0c) to head (59c99c7).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6359      +/-   ##
==========================================
- Coverage   96.34%   96.34%   -0.01%     
==========================================
  Files         552      552              
  Lines       41939    41944       +5     
  Branches     6357     6358       +1     
==========================================
+ Hits        40408    40411       +3     
- Misses       1491     1493       +2     
  Partials       40       40              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@keelii keelii closed this Jan 24, 2025
@keelii keelii deleted the feat/make_printf_working_with_colors branch January 24, 2025 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants