Readme & CI
Added a project readme and setup CI pipelines for GH Actions. Pipelines added for user guide publishing and tests.
This commit is contained in:
parent
8f8bd96dae
commit
3b099bfbb0
|
@ -0,0 +1,14 @@
|
|||
name: Tests
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Build
|
||||
run: cargo test
|
|
@ -1,4 +1,4 @@
|
|||
name: Publish Documentation
|
||||
name: User Guide
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
@ -10,11 +10,9 @@ jobs:
|
|||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Build
|
||||
- name: Build
|
||||
run: |
|
||||
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/5Sigma/codex/releases/latest/download/Codex-installer.sh | sh
|
||||
codex -r docs build
|
||||
|
|
|
@ -5,6 +5,14 @@ edition = "2021"
|
|||
description = "TUI made simple"
|
||||
authors = ["Joe Bellus"]
|
||||
license = "MIT"
|
||||
exclude = [
|
||||
"docs/*"
|
||||
]
|
||||
homepage = "https://5sigma.github.io/arkham"
|
||||
repository = "https://github.com/5Sigma/arkham"
|
||||
readme = "readme.md"
|
||||
keywords = ["terminal", "tui", "cli", "console"]
|
||||
categories = ["command-line-interface", "command-line-utilities"]
|
||||
|
||||
[[example]]
|
||||
name = "simple"
|
||||
|
|
|
@ -3,12 +3,7 @@ title: Arkham
|
|||
subtitle: An Ergonomic TUI Framework
|
||||
---
|
||||
|
||||
|
||||
```Rust
|
||||
fn welcome(ctx &mut ViewContext) {
|
||||
ctx.insert((0,0), "Welcome");
|
||||
}
|
||||
```
|
||||
![welcome](/welcome.png)
|
||||
|
||||
# Robust TUI foundation
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 117 KiB |
|
@ -9,8 +9,8 @@ fn main() {
|
|||
|
||||
fn root(ctx: &mut ViewContext, theme: Res<Theme>) {
|
||||
let size = ctx.size();
|
||||
ctx.paint(size, theme.bg_primary);
|
||||
ctx.paint(Rect::new((5, 5), size - 10), theme.bg_secondary);
|
||||
ctx.fill_all(theme.bg_primary);
|
||||
ctx.fill(Rect::new((5, 5), size - 10), theme.bg_secondary);
|
||||
ctx.insert((10, 10), "Hello World");
|
||||
ctx.insert(
|
||||
((size.width / 2) - 7, 0),
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
<div align="center">
|
||||
<h1>Arkham</h1>
|
||||
<p>
|
||||
<strong>An ergonomic TUI Framework</strong>
|
||||
</p>
|
||||
<p>
|
||||
<!-- prettier-ignore-start -->
|
||||
|
||||
[![crates.io](https://img.shields.io/crates/v/arkham?label=latest)](https://crates.io/crates/arkham)
|
||||
[![Documentation](https://docs.rs/arkham/badge.svg?version=0.2.1)](https://docs.rs/arkham/0.2.1)
|
||||
![Crates.io Downloads (latest version)](https://img.shields.io/crates/dv/arkham)
|
||||
<br/>
|
||||
[![guide](https://github.com/5sigma/arkham/actions/workflows/docs.yml/badge.svg)](https://github.com/5sigma/arkham/actions/workflows/docs.yml)
|
||||
[![CI](https://github.com/5sigma/arkham/actions/workflows/ci.yml/badge.svg)](https://github.com/5sigma/arkham/actions/workflows/ci.yml)
|
||||
|
||||
[Read The Guide](https://5sigma.github.io/arkham)
|
||||
|
||||
<!-- prettier-ignore-end -->
|
||||
<p>
|
||||
</div>
|
||||
|
||||
![Welcome](docs/static/welcome.png)
|
||||
|
||||
# Robust TUI foundation
|
||||
|
||||
Arkham attempts to give a firm foundation for building TUI Apps.
|
||||
It does not provide a set of widgets or components that can be used.
|
||||
Instead, it tries to make the process of building terminal interfaces
|
||||
easy enough that they aren't necessary.
|
||||
|
||||
- Keyboard handling
|
||||
- Terminal modification
|
||||
- Full screen terminal UIs with _alternate screen_ handling
|
||||
- Full run loop and rendering engine
|
||||
- Easy text formatting and styling
|
||||
- Ergonomic component architecture
|
||||
- Dependency injection
|
||||
|
||||
# Components are simple functions
|
||||
|
||||
```Rust
|
||||
fn my_component(ctx &mut ViewContext) {
|
||||
ctx.insert((0,0), "Welcome");
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# Easily handle text styling
|
||||
|
||||
```Rust
|
||||
fn my_component(ctx &mut ViewContext) {
|
||||
ctx.insert(
|
||||
(0,0),
|
||||
"Welcome"
|
||||
.to_runes()
|
||||
.bg(Color::Blue)
|
||||
.fg(Color::White),
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
# Painless dependency injection
|
||||
|
||||
```Rust
|
||||
fn my_component(ctx &mut ViewContext, user: Res<MyUser>) {
|
||||
ctx.insert(
|
||||
(0,0),
|
||||
format!("Hello, {}", user.name),
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
# Easy keyboard handling
|
||||
|
||||
```Rust
|
||||
fn my_component(ctx &mut ViewContext, kb: Res<Keyboard>) {
|
||||
if kb.char() == Some('x') {
|
||||
ctx.insert(
|
||||
(0,0),
|
||||
"X marks the spot"
|
||||
);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ where
|
|||
/// state.
|
||||
///
|
||||
/// Example:
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use arkham::prelude::*;
|
||||
/// struct MyResource {
|
||||
/// value: i32
|
||||
|
@ -126,7 +126,7 @@ where
|
|||
/// is meant to store application state.
|
||||
///
|
||||
/// Example:
|
||||
/// ```
|
||||
/// ```no_run
|
||||
/// use arkham::prelude::*;
|
||||
/// struct MyState {
|
||||
/// value: i32
|
||||
|
|
10
src/view.rs
10
src/view.rs
|
@ -70,16 +70,6 @@ impl View {
|
|||
(self.width(), self.height()).into()
|
||||
}
|
||||
|
||||
/// Paint is a conveinence method for filling a region ith a given color.
|
||||
/// This is done by using the passed color as the background color and
|
||||
/// filling the region with ' ' characters.
|
||||
pub fn paint<R>(&mut self, rect: R, color: Color)
|
||||
where
|
||||
R: Into<Rect>,
|
||||
{
|
||||
self.fill(rect, Rune::new().content(' ').bg(color));
|
||||
}
|
||||
|
||||
/// Fill a region of the view with a single rune, repeating it in every
|
||||
/// position.
|
||||
pub fn fill<R, U>(&mut self, rect: R, rune: U)
|
||||
|
|
Loading…
Reference in New Issue