cursive/examples/Readme.md

110 lines
3.0 KiB
Markdown
Raw Normal View History

2017-11-17 19:27:24 +00:00
# Cursive Examples
Here are example programs using Cursive to help you getting familiar with the
various aspects of the library.
2020-04-24 00:13:50 +00:00
To run an example, use `cargo run --bin EXAMPLE_NAME`.
2017-11-17 19:27:24 +00:00
2020-04-24 00:13:50 +00:00
To use a specific cursive backend, you can do, for example:
```
cargo run --bin EXAMPLE_NAME --features cursive/crossterm-backend --no-default-features
2020-04-24 00:13:50 +00:00
```
## [`hello_world`](src/bin/hello_world.rs)
2017-11-17 19:27:24 +00:00
Simplest example possible, it will show you the starting point of a basic
Cursive application.
2020-04-24 00:13:50 +00:00
## [`dialog`](src/bin/dialog.rs)
2017-11-17 19:27:24 +00:00
This example wraps the text in a `Dialog` view, showing the basic idea of view
composition.
2020-04-24 00:13:50 +00:00
## [`lorem`](src/bin/lorem.rs)
2017-11-17 19:27:24 +00:00
This example loads a large text file to show scrolling behaviour. It also
includes greek and japanese characters to show non-ascii support.
2020-04-24 00:13:50 +00:00
## [`edit`](src/bin/edit.rs)
2017-11-17 19:27:24 +00:00
Here we have an `EditView` to get input from the user, and use that input in
2020-01-06 23:41:51 +00:00
the next view. It shows how to identify a view with an name and refer to it
2017-11-17 19:27:24 +00:00
later.
2020-04-24 00:13:50 +00:00
## [`mutation`](src/bin/mutation.rs)
2017-11-17 19:27:24 +00:00
This example modifies the content of an existing view.
2020-04-24 00:13:50 +00:00
## [`linear`](src/bin/linear.rs)
2017-11-17 19:27:24 +00:00
This example uses a `LinearView` to put multiple views side-by-side.
2020-04-24 00:13:50 +00:00
## [`menubar`](src/bin/menubar.rs)
2017-11-17 19:27:24 +00:00
Here we learn how to create a menubar at the top of the screen, and populate
it with static and dynamic entried.
2020-04-24 00:13:50 +00:00
## [`logs`](src/bin/logs.rs)
2017-11-17 19:27:24 +00:00
This example defines a custom view to display asynchronous input from a
channel.
2020-04-24 00:13:50 +00:00
## [`key_codes`](src/bin/key_codes.rs)
2017-11-17 19:27:24 +00:00
This example uses a custom view to print any input received. Can be used as a
debugging tool to see what input the application is receiving.
2020-04-24 00:13:50 +00:00
## [`select`](src/bin/select.rs)
2017-11-17 19:27:24 +00:00
This example uses a `SelectView` to have the user pick a city from a long list.
2020-04-24 00:13:50 +00:00
## [`list_view`](src/bin/list_view.rs)
2017-11-17 19:27:24 +00:00
This shows a use of a `ListView`, used to build simple forms.
2020-04-24 00:13:50 +00:00
## [`text_area`](src/bin/text_area.rs)
2017-11-17 19:27:24 +00:00
This example uses a `TextArea`, where the user can input a block of text.
2020-04-24 00:13:50 +00:00
## [`markup`](src/bin/markup.rs)
2018-01-18 18:32:08 +00:00
This example prints a text with markup decorations.
2020-04-24 00:13:50 +00:00
## [`theme`](src/bin/theme.rs)
2017-11-17 19:27:24 +00:00
This loads a theme file at runtime to change default colors.
2020-04-24 00:13:50 +00:00
## [`theme_manual`](src/bin/theme_manual.rs)
2017-11-17 19:27:24 +00:00
Instead of loading a theme file, this manually sets various theme settings.
2020-04-24 00:13:50 +00:00
## [`terminal_default`](src/bin/terminal_default.rs)
2017-11-17 19:27:24 +00:00
This example shows the effect of the `Color::TerminalDefault` setting.
2020-04-24 00:13:50 +00:00
## [`colors`](src/bin/colors.rs)
2017-11-17 19:27:24 +00:00
This example draws a colorful square to show off true color support.
2020-04-24 00:13:50 +00:00
## [`refcell_view`](src/bin/refcell_view.rs)
2017-11-17 19:27:24 +00:00
2020-01-06 23:41:51 +00:00
Here we show how to access multiple views concurently through their name.
2017-11-17 19:27:24 +00:00
2020-04-24 00:13:50 +00:00
## [`progress`](src/bin/progress.rs)
2017-11-17 19:27:24 +00:00
This shows how to send information from an asynchronous task (like a download
or slow computation) to update a progress bar.
2020-04-24 00:13:50 +00:00
## [`radio`](src/bin/radio.rs)
2017-11-17 19:27:24 +00:00
This shows how to use `RadioGroup` and `RadioButton`.
2020-04-24 00:13:50 +00:00
## [`slider`](src/bin/slider.rs)
2017-11-17 19:27:24 +00:00
This is a demonstration of the `SliderView`.
2018-01-18 18:32:08 +00:00
2020-04-24 00:13:50 +00:00
## [`mines`](src/bin/mines) (**Work in progress**)
2018-01-18 18:32:08 +00:00
A larger example showing an implementation of minesweeper.