Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/facebookincubator/superconsole
The superconsole crate provides a handler and building blocks for powerful, yet minimally intrusive TUIs. It is cross platform, supporting Windows 7+, Linux, and MacOS. Rustaceans who want to create non-interactive TUIs can use the component composition building block system to quickly deploy their code.
https://github.com/facebookincubator/superconsole
Last synced: about 1 month ago
JSON representation
The superconsole crate provides a handler and building blocks for powerful, yet minimally intrusive TUIs. It is cross platform, supporting Windows 7+, Linux, and MacOS. Rustaceans who want to create non-interactive TUIs can use the component composition building block system to quickly deploy their code.
- Host: GitHub
- URL: https://github.com/facebookincubator/superconsole
- Owner: facebookincubator
- License: apache-2.0
- Created: 2021-12-20T18:03:32.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-16T22:50:58.000Z (about 2 months ago)
- Last Synced: 2024-10-18T22:59:33.777Z (about 2 months ago)
- Language: Rust
- Homepage:
- Size: 6.38 MB
- Stars: 481
- Watchers: 27
- Forks: 14
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE-APACHE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-buck2 - SuperConsole
README
# A component-based framework for building Rust Text-based User Interfaces (TUIs)
There are several copies of this repo on GitHub,
[facebookincubator/superconsole](https://github.com/facebookincubator/superconsole)
is the canonical one.The superconsole framework provides a powerful line based abstraction over text
based rendering to the terminal. It also provides basic building blocks like
line manipulation, and a higher level of composable components. A base set of
"batteries" components are included to help developers create Text-based User
Interfaces (TUIs) as quickly as possible.The design choices that underly superconsole are selected to prioritize
testability, ease of composition, and flexibility.Superconsole also offers stylization, including italics, underlining, bolding,
and coloring text. Furthermore, relying on crossterm ensures that it is
compatible with Windows, Unix, and MacOS.Finally, superconsole delineates between rendering logic and program state -
each render call accepts an immutable reference to state, which components may
use to inject state into their otherwise immutable rendering logic.## Demo
![Superconsole running some buck2 tests](demo.gif)
## Examples
```rust
use superconsole::components::bordering::{Bordered, BorderedSpec};
use superconsole::{Component, Dimensions, DrawMode, Lines, SuperConsole};#[derive(Debug)]
struct HelloWorld;impl Component for HelloWorld {
fn draw_unchecked(&self, _dimensions: Dimensions, _mode: DrawMode) -> anyhow::Result {
Ok(Lines(vec![
vec!["Hello world!".to_owned()].try_into().unwrap(),
]))
}
}pub fn main() -> anyhow::Result<()> {
let bordering = BorderedSpec::default();
let mut superconsole = SuperConsole::new().ok_or_else(|| anyhow::anyhow!("Not a TTY"))?;
let component = Bordered::new(HelloWorld, bordering);
superconsole.render(&component)?;
superconsole.finalize(&component)?;
Ok(())
}
```See the [CONTRIBUTING](CONTRIBUTING.md) file for how to help out.
## License
Superconsole is both MIT and Apache License, Version 2.0 licensed, as found in
the [LICENSE-MIT](LICENSE-MIT) and [LICENSE-APACHE](LICENSE-APACHE) files.