feat: add cli formatting

This commit is contained in:
Artemy Egorov 2024-08-11 16:32:23 +03:00
parent 6338097658
commit aaa4328818
3 changed files with 72 additions and 68 deletions

2
Cargo.lock generated
View file

@ -201,7 +201,7 @@ dependencies = [
[[package]] [[package]]
name = "dalet" name = "dalet"
version = "1.0.0-pre.14" version = "1.0.0-pre.15"
dependencies = [ dependencies = [
"ariadne", "ariadne",
"bincode", "bincode",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "dalet" name = "dalet"
version = "1.0.0-pre.14" version = "1.0.0-pre.15"
edition = "2021" edition = "2021"
authors = ["artegoser"] authors = ["artegoser"]
license = "MIT" license = "MIT"
@ -11,6 +11,10 @@ readme = "./README.md"
keywords = ["dalet"] keywords = ["dalet"]
categories = ["compression", "compilers", "encoding"] categories = ["compression", "compilers", "encoding"]
[[bin]]
name = "dalet"
path = "src/main.rs"
[dependencies] [dependencies]
clap = { version = "4.5.13", features = ["derive"] } clap = { version = "4.5.13", features = ["derive"] }
num_enum = "0.7.3" num_enum = "0.7.3"

View file

@ -42,79 +42,79 @@ br
# if no tag is specified but a '{- text}' is present, then the 'p' tag is placed # if no tag is specified but a '{- text}' is present, then the 'p' tag is placed
# '\n' is replaced with ' ' in this format. # '\n' is replaced with ' ' in this format.
{- {-
Check Dalet too Check Dalet too
This is one paragraph This is one paragraph
} }
{- {-
This is another paragraph ({- text\}) This is another paragraph ({- text\})
} }
row "center" [ row "center" [
link "https://github.com/txtdot/txtdot": Homepage link "https://github.com/txtdot/txtdot": Homepage
btn "https://example.com/donate" [ btn "https://example.com/donate" [
# tag without body # tag without body
img "https://example.com/donate.png" img "https://example.com/donate.png"
Donate Donate
] ]
] ]
# [] for multiple tags # [] for multiple tags
row [ row [
# if no tag is specified but a '[[]]' is present, then the 'el' tag # if no tag is specified but a '[[]]' is present, then the 'el' tag
# with multiple tags body placed # 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
[[ [[
h3: Dev h2: Features
# {} for multiline strings, indent is automatically trimmed ul [
code { Server-side page simplification
npm install Media proxy
npm run dev Image compression with Sharp
} Rendering client-side apps `Vanilla, React, Vue, etc` with webder
Search with SearXNG
# {~n Text} n is number of minimum spaces Handy API endpoints
code "markdown" {~4 No client JavaScript
this is codeblock Some kind of Material Design 3
} Customization with plugins, see @txtdot/sdk and @txtdot/plugins
]
# {# Text} Text after "`# " not modified
code "markdown" {# this is codeblock}
]] ]]
[[ [[
h3: Production h2: Running
code {
npm install
npm run build
npm run start
}
]]
[[ [[
h3: Docker h3: Dev
code: docker compose up -d
]]
]] # {} 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 # Table has custom format if text used
@ -126,13 +126,13 @@ row [
# Description # Description
# ] # ]
table { table {
+| Tag | Description | +| Tag | Description |
| h | Heading | | h | Heading |
| p | Paragraph | | p | Paragraph |
| img | Image | | img | Image |
| link | Link | | link | Link |
| btn | Button | | btn | Button |
| ul | Unordered list | | ul | Unordered list |
| br | Line break | | br | Line break |
+| quantity | 7 | +| quantity | 7 |
} }