From aaa43288189ec490bc4f3655b79642d3e15b9f1b Mon Sep 17 00:00:00 2001 From: Artemy Egorov Date: Sun, 11 Aug 2024 16:32:23 +0300 Subject: [PATCH] feat: add cli formatting --- Cargo.lock | 2 +- Cargo.toml | 6 +- examples/daleth.dlth | 132 +++++++++++++++++++++---------------------- 3 files changed, 72 insertions(+), 68 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a89074a..491f294 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -201,7 +201,7 @@ dependencies = [ [[package]] name = "dalet" -version = "1.0.0-pre.14" +version = "1.0.0-pre.15" dependencies = [ "ariadne", "bincode", diff --git a/Cargo.toml b/Cargo.toml index c0a2648..f3b430e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dalet" -version = "1.0.0-pre.14" +version = "1.0.0-pre.15" edition = "2021" authors = ["artegoser"] license = "MIT" @@ -11,6 +11,10 @@ readme = "./README.md" keywords = ["dalet"] categories = ["compression", "compilers", "encoding"] +[[bin]] +name = "dalet" +path = "src/main.rs" + [dependencies] clap = { version = "4.5.13", features = ["derive"] } num_enum = "0.7.3" diff --git a/examples/daleth.dlth b/examples/daleth.dlth index 629cc5a..a3f684b 100644 --- a/examples/daleth.dlth +++ b/examples/daleth.dlth @@ -42,79 +42,79 @@ br # if no tag is specified but a '{- text}' is present, then the 'p' tag is placed # '\n' is replaced with ' ' in this format. {- - Check Dalet too - This is one paragraph + Check Dalet too + This is one paragraph } {- - This is another paragraph ({- text\}) + This is another paragraph ({- text\}) } row "center" [ - link "https://github.com/txtdot/txtdot": Homepage - btn "https://example.com/donate" [ - # tag without body - img "https://example.com/donate.png" - Donate - ] + link "https://github.com/txtdot/txtdot": Homepage + btn "https://example.com/donate" [ + # tag without body + img "https://example.com/donate.png" + Donate + ] ] # [] for multiple tags row [ - # if no tag is specified but a '[[]]' is present, then the 'el' tag - # with multiple tags body placed - [[ - h2: Features - - ul [ - Server-side page simplification - Media proxy - Image compression with Sharp - Rendering client-side apps `Vanilla, React, Vue, etc` with webder - Search with SearXNG - Handy API endpoints - No client JavaScript - Some kind of Material Design 3 - Customization with plugins, see @txtdot/sdk and @txtdot/plugins - ] - ]] - - [[ - h2: Running - + # if no tag is specified but a '[[]]' is present, then the 'el' tag + # with multiple tags body placed [[ - h3: Dev + h2: Features - # {} for multiline strings, indent is automatically trimmed - code { - npm install - npm run dev - } - - # {~n Text} n is number of minimum spaces - code "markdown" {~4 - this is codeblock - } - - # {# Text} Text after "`# " not modified - code "markdown" {# this is codeblock} + ul [ + Server-side page simplification + Media proxy + Image compression with Sharp + Rendering client-side apps `Vanilla, React, Vue, etc` with webder + Search with SearXNG + Handy API endpoints + No client JavaScript + Some kind of Material Design 3 + Customization with plugins, see @txtdot/sdk and @txtdot/plugins + ] ]] [[ - h3: Production - code { - npm install - npm run build - npm run start - } - ]] + h2: Running - [[ - h3: Docker - code: docker compose up -d - ]] + [[ + h3: Dev - ]] + # {} for multiline strings, indent is automatically trimmed + code { + npm install + npm run dev + } + + # {~n Text} n is number of minimum spaces + code "markdown" {~4 + this is codeblock + } + + # {# Text} Text after "`# " not modified + code "markdown" {# this is codeblock} + ]] + + [[ + h3: Production + code { + npm install + npm run build + npm run start + } + ]] + + [[ + h3: Docker + code: docker compose up -d + ]] + + ]] ] # Table has custom format if text used @@ -126,13 +126,13 @@ row [ # Description # ] table { - +| Tag | Description | - | h | Heading | - | p | Paragraph | - | img | Image | - | link | Link | - | btn | Button | - | ul | Unordered list | - | br | Line break | - +| quantity | 7 | -} + +| Tag | Description | + | h | Heading | + | p | Paragraph | + | img | Image | + | link | Link | + | btn | Button | + | ul | Unordered list | + | br | Line break | + +| quantity | 7 | +} \ No newline at end of file