diff --git a/README.md b/README.md index 8708eb5..ad529df 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,25 @@ print("Oh, we are back to normal now...") Source code: [examples/coquille_context/](https://github.com/qexat/Coquille/blob/main/examples/coquille_context/__main__.py) +### Coquille.print() + +```py +from coquille import Coquille +from coquille.sequences import bold, fg_blue, fg_magenta, italic + +print("Hello World!") + +Coquille.print("Hello World, but in magenta and italic!", fg_magenta, italic) + +with open("examples/coquille_print/output.txt", "w") as my_file: + Coquille.print("A pretty Hello World in a file!", fg_blue, bold, file=my_file) + +``` + +![screenshot.png](https://raw.githubusercontent.com/qexat/Coquille/main/examples/coquille_print/screenshot.png) + +Source code: [examples/coquille_print/](https://github.com/qexat/Coquille/blob/main/examples/coquille_print/__main__.py) + ## Documentation Coming soon! 🚧 diff --git a/examples/coquille_print/__main__.py b/examples/coquille_print/__main__.py new file mode 100644 index 0000000..9fe1cb3 --- /dev/null +++ b/examples/coquille_print/__main__.py @@ -0,0 +1,12 @@ +from coquille import Coquille +from coquille.sequences import bold +from coquille.sequences import fg_blue +from coquille.sequences import fg_magenta +from coquille.sequences import italic + +print("Hello World!") + +Coquille.print("Hello World, but in magenta and italic!", fg_magenta, italic) + +with open("examples/coquille_print/output.txt", "w") as my_file: + Coquille.print("A pretty Hello World in a file!", fg_blue, bold, file=my_file) diff --git a/examples/coquille_print/output.txt b/examples/coquille_print/output.txt new file mode 100644 index 0000000..8ea42f1 --- /dev/null +++ b/examples/coquille_print/output.txt @@ -0,0 +1 @@ +A pretty Hello World in a file! diff --git a/examples/coquille_print/screenshot.png b/examples/coquille_print/screenshot.png new file mode 100644 index 0000000..64bc0ed Binary files /dev/null and b/examples/coquille_print/screenshot.png differ diff --git a/src/coquille/coquille.py b/src/coquille/coquille.py index 8844d3f..5041674 100644 --- a/src/coquille/coquille.py +++ b/src/coquille/coquille.py @@ -175,7 +175,7 @@ def print( ) -> None: """ A function relatively similar to built-in `print`, but with - support of escape sequences that are prepended before the printed + support of escape sequences that are prepended to the printed text. Example: