Skip to content

Commit

Permalink
Add more examples (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
qexat authored May 2, 2023
1 parent 9d7b2b4 commit 77f3f34
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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! 🚧
12 changes: 12 additions & 0 deletions examples/coquille_print/__main__.py
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions examples/coquille_print/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A pretty Hello World in a file!
Binary file added examples/coquille_print/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/coquille/coquille.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 77f3f34

Please sign in to comment.