Add demo script
This commit is contained in:
parent
cd0e1e7609
commit
24f6c0552f
3 changed files with 39 additions and 0 deletions
|
@ -2,6 +2,8 @@
|
|||
|
||||
Fancy pretty-printing utilities for [[https://cons.io/][Gerbil Scheme]].
|
||||
|
||||
[[./demo.png]]
|
||||
|
||||
** Features
|
||||
|
||||
- [[https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_(Control_Sequence_Introducer)_sequences][ANSI control codes]] for styling and cursor movement
|
||||
|
|
BIN
demo.png
Normal file
BIN
demo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 43 KiB |
37
demo.ss
Executable file
37
demo.ss
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env gxi
|
||||
|
||||
(export main)
|
||||
|
||||
(import :std/format
|
||||
:std/iter
|
||||
:gerbil/gambit/threads
|
||||
:dlozeve/fancy/format
|
||||
:dlozeve/fancy/table
|
||||
:dlozeve/fancy/rule
|
||||
:dlozeve/fancy/spinner)
|
||||
|
||||
(def (main)
|
||||
(display (rule "[bold green]Fancy demo" style: 'simple))
|
||||
(displayln)
|
||||
(displayln (parse-markup
|
||||
"[bold red]Lorem ipsum[/bold red] dolor sit amet, [underline]consectetur[/underline] adipiscing elit, sed do
|
||||
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
|
||||
minim veniam, [cyan]quis nostrud exercitation [bold]ullamco[/bold] laboris[/cyan] nisi ut
|
||||
aliquip ex ea commodo consequat. Duis aute irure dolor in
|
||||
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
||||
pariatur. [yellow]Excepteur sint [underline]occaecat[/yellow underline] cupidatat non proident, sunt in
|
||||
culpa qui officia deserunt mollit anim id est laborum."))
|
||||
(displayln)
|
||||
|
||||
(def tab (table '("[bold]#" "[bold]Name" "[bold]Property") '(3 20 20)))
|
||||
(display (table-header tab))
|
||||
(display (table-row tab "42" "[green]Foo" "Bar"))
|
||||
(display (table-row tab "21" "[red]Toto" "Blublu"))
|
||||
(display (table-footer tab))
|
||||
(displayln)
|
||||
(displayln)
|
||||
(for ((i (in-range 20)))
|
||||
(display (spinner i "[yellow]Waiting:" (format "(computing ~d/20)" (1+ i))
|
||||
style: 'dots))
|
||||
(thread-sleep! 0.1))
|
||||
(displayln))
|
Loading…
Add table
Add a link
Reference in a new issue