This repository has been archived by the owner on Jul 16, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor and enhance the external api of printer-ansi (#444)
- Loading branch information
Showing
33 changed files
with
2,481 additions
and
754 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@effect/printer-ansi": minor | ||
--- | ||
|
||
refactor and enhance the external api of printer-ansi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,16 @@ | ||
import * as AnsiRender from "@effect/printer-ansi/AnsiRender" | ||
import * as AnsiStyle from "@effect/printer-ansi/AnsiStyle" | ||
import * as Color from "@effect/printer-ansi/Color" | ||
import * as Doc from "@effect/printer/Doc" | ||
import * as Ansi from "@effect/printer-ansi/Ansi" | ||
import * as Doc from "@effect/printer-ansi/AnsiDoc" | ||
|
||
const doc = Doc.annotate( | ||
Doc.hsep([ | ||
Doc.text("red"), | ||
Doc.align( | ||
Doc.vsep([ | ||
Doc.annotate( | ||
Doc.hsep([ | ||
Doc.text("blue+u"), | ||
Doc.annotate( | ||
Doc.text("bold"), | ||
AnsiStyle.combine(AnsiStyle.color(Color.blue), AnsiStyle.bold) | ||
), | ||
Doc.text("blue+u") | ||
]), | ||
AnsiStyle.combine(AnsiStyle.color(Color.blue), AnsiStyle.underlined) | ||
), | ||
Doc.text("red") | ||
]) | ||
) | ||
]), | ||
AnsiStyle.color(Color.red) | ||
) | ||
console.log(AnsiRender.prettyDefault(doc)) | ||
const doc = Doc.hsep([ | ||
Doc.text("red"), | ||
Doc.align(Doc.vsep([ | ||
Doc.hsep([ | ||
Doc.text("blue+u"), | ||
Doc.text("bold").pipe(Doc.annotate(Ansi.bold)), | ||
Doc.text("blue+u") | ||
]).pipe(Doc.annotate(Ansi.combine(Ansi.blue, Ansi.underlined))), | ||
Doc.text("red") | ||
])) | ||
]).pipe(Doc.annotate(Ansi.red)) | ||
|
||
console.log(Doc.render(doc, { style: "pretty" })) |
Oops, something went wrong.