From b51eab31876a7b444c303b41d02e30d7d57a2400 Mon Sep 17 00:00:00 2001 From: Josh McKinney Date: Thu, 14 Dec 2023 23:03:29 -0800 Subject: [PATCH] Move template to subtemplate named simple (#22) --- .markdownlint.toml | 1 + Cargo.lock | 281 -------------------------------- README.md | 22 ++- cargo-generate.toml | 2 +- .gitignore => simple/.gitignore | 0 Cargo.toml => simple/Cargo.toml | 2 +- {src => simple/src}/app.rs | 0 {src => simple/src}/event.rs | 0 {src => simple/src}/handler.rs | 0 {src => simple/src}/lib.rs | 0 {src => simple/src}/main.rs | 0 {src => simple/src}/tui.rs | 0 {src => simple/src}/ui.rs | 0 13 files changed, 13 insertions(+), 295 deletions(-) create mode 100644 .markdownlint.toml delete mode 100644 Cargo.lock rename .gitignore => simple/.gitignore (100%) rename Cargo.toml => simple/Cargo.toml (87%) rename {src => simple/src}/app.rs (100%) rename {src => simple/src}/event.rs (100%) rename {src => simple/src}/handler.rs (100%) rename {src => simple/src}/lib.rs (100%) rename {src => simple/src}/main.rs (100%) rename {src => simple/src}/tui.rs (100%) rename {src => simple/src}/ui.rs (100%) diff --git a/.markdownlint.toml b/.markdownlint.toml new file mode 100644 index 0000000..242227a --- /dev/null +++ b/.markdownlint.toml @@ -0,0 +1 @@ +line-length = { line_length = 100 } diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index dc9a2aa..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,281 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "cassowary" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df8670b8c7b9dae1793364eafadf7239c40d669904660c5960d74cfd80b46a53" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "crossterm" -version = "0.26.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13" -dependencies = [ - "bitflags", - "crossterm_winapi", - "libc", - "mio", - "parking_lot", - "signal-hook", - "signal-hook-mio", - "winapi", -] - -[[package]] -name = "crossterm_winapi" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ae1b35a484aa10e07fe0638d02301c5ad24de82d310ccbd2f3693da5f09bf1c" -dependencies = [ - "winapi", -] - -[[package]] -name = "libc" -version = "0.2.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" - -[[package]] -name = "lock_api" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "mio" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys", -] - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-sys", -] - -[[package]] -name = "ratatui" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcc0d032bccba900ee32151ec0265667535c230169f5a011154cdcd984e16829" -dependencies = [ - "bitflags", - "cassowary", - "crossterm", - "unicode-segmentation", - "unicode-width", -] - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "signal-hook" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d" -dependencies = [ - "libc", - "signal-hook-registry", -] - -[[package]] -name = "signal-hook-mio" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" -dependencies = [ - "libc", - "mio", - "signal-hook", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" -dependencies = [ - "libc", -] - -[[package]] -name = "smallvec" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" - -[[package]] -name = "unicode-segmentation" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" - -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" - -[[package]] -name = "{{crate_name}}" -version = "0.1.0" -dependencies = [ - "crossterm", - "ratatui", -] diff --git a/README.md b/README.md index 1111e32..66e2ecb 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,13 @@ -# `template` 🧀 +# Ratatui templates 🧀 -A template for bootstrapping a Rust +This repository contains templates for bootstrapping a Rust [**TUI**](https://en.wikipedia.org/wiki/Text-based_user_interface) application with [`Ratatui`](https://github.com/ratatui-org/ratatui) & [`crossterm`](https://github.com/crossterm-rs/crossterm). - - ## Project structure -``` +```text src/ ├── app.rs -> holds the state and application logic ├── event.rs -> handles the terminal events (key press, mouse click, resize, etc.) @@ -24,15 +22,15 @@ src/ 1. Install [`cargo-generate`](https://github.com/cargo-generate/cargo-generate#installation) -```sh -cargo install cargo-generate -``` + ```shell + cargo install cargo-generate + ``` -2. Clone this repository via `cargo-generate`: +2. Create a new app based on this repository: -```sh -cargo generate --git https://github.com/ratatui-org/template --name -``` + ```shell + cargo generate ratatui-org/ratatui-template simple + ``` ## See also diff --git a/cargo-generate.toml b/cargo-generate.toml index 5ac4ec8..538b785 100644 --- a/cargo-generate.toml +++ b/cargo-generate.toml @@ -1,4 +1,4 @@ # configuration for https://cargo-generate.github.io/cargo-generate/ [template] -ignore = ["README.md", ".github/"] +sub_templates = ["simple"] diff --git a/.gitignore b/simple/.gitignore similarity index 100% rename from .gitignore rename to simple/.gitignore diff --git a/Cargo.toml b/simple/Cargo.toml similarity index 87% rename from Cargo.toml rename to simple/Cargo.toml index a997e36..21497e1 100644 --- a/Cargo.toml +++ b/simple/Cargo.toml @@ -6,5 +6,5 @@ license = "MIT" edition = "2021" [dependencies] -crossterm = "0.26.1" +crossterm = "0.27.0" ratatui = "0.24.0" diff --git a/src/app.rs b/simple/src/app.rs similarity index 100% rename from src/app.rs rename to simple/src/app.rs diff --git a/src/event.rs b/simple/src/event.rs similarity index 100% rename from src/event.rs rename to simple/src/event.rs diff --git a/src/handler.rs b/simple/src/handler.rs similarity index 100% rename from src/handler.rs rename to simple/src/handler.rs diff --git a/src/lib.rs b/simple/src/lib.rs similarity index 100% rename from src/lib.rs rename to simple/src/lib.rs diff --git a/src/main.rs b/simple/src/main.rs similarity index 100% rename from src/main.rs rename to simple/src/main.rs diff --git a/src/tui.rs b/simple/src/tui.rs similarity index 100% rename from src/tui.rs rename to simple/src/tui.rs diff --git a/src/ui.rs b/simple/src/ui.rs similarity index 100% rename from src/ui.rs rename to simple/src/ui.rs