{"id":13438669,"url":"https://github.com/gyscos/Cursive","last_synced_at":"2025-03-20T06:31:06.591Z","repository":{"id":37451342,"uuid":"35341769","full_name":"gyscos/cursive","owner":"gyscos","description":"A Text User Interface library for the Rust programming language","archived":false,"fork":false,"pushed_at":"2025-01-09T16:56:29.000Z","size":3473,"stargazers_count":4445,"open_issues_count":200,"forks_count":250,"subscribers_count":38,"default_branch":"main","last_synced_at":"2025-03-18T03:11:26.757Z","etag":null,"topics":["ncurses","rust","terminal","tui"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gyscos.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-05-09T19:17:50.000Z","updated_at":"2025-03-17T06:34:27.000Z","dependencies_parsed_at":"2023-02-16T10:45:44.881Z","dependency_job_id":"e530ed74-a09e-4a64-b307-af405ec07fd2","html_url":"https://github.com/gyscos/cursive","commit_stats":{"total_commits":1533,"total_committers":102,"mean_commits":"15.029411764705882","dds":"0.12263535551206783","last_synced_commit":"30046dc563b3041092f0f0475ddf87a84eef25f9"},"previous_names":[],"tags_count":79,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gyscos%2Fcursive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gyscos%2Fcursive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gyscos%2Fcursive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gyscos%2Fcursive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gyscos","download_url":"https://codeload.github.com/gyscos/cursive/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244565210,"owners_count":20473230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ncurses","rust","terminal","tui"],"created_at":"2024-07-31T03:01:07.394Z","updated_at":"2025-03-20T06:31:01.579Z","avatar_url":"https://github.com/gyscos.png","language":"Rust","readme":"# Cursive\n\n[![crates.io](https://img.shields.io/crates/v/cursive.svg)](https://crates.io/crates/cursive)\n[![Rust](https://github.com/gyscos/cursive/actions/workflows/rust.yml/badge.svg?branch=main)](https://github.com/gyscos/cursive/actions/workflows/rust.yml)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)\n[![Gitter chat](https://badges.gitter.im/gyscos/cursive.png)](https://gitter.im/cursive-rs/cursive)\n\n\nCursive is a TUI (Text User Interface) library for rust. It uses the [`crossterm`] backend by default, but [other backends are available](https://github.com/gyscos/cursive/wiki/Backends).\n\nIt allows you to build rich user interfaces for terminal applications.\n\n[`crossterm`]: https://github.com/crossterm-rs/crossterm\n\n# [Documentation](http://docs.rs/cursive)\n\nIt is designed to be safe and easy to use:\n\n```toml\n[dependencies]\ncursive = \"0.21\"\n```\n\nOr to use the latest git version:\n\n```toml\n[dependencies]\ncursive = { git = \"https://github.com/gyscos/cursive\" }\n```\n\n```rust,no_run\nuse cursive::views::{Dialog, TextView};\n\nfn main() {\n    // Creates the cursive root - required for every application.\n    let mut siv = cursive::default();\n\n    // Creates a dialog with a single \"Quit\" button\n    siv.add_layer(Dialog::around(TextView::new(\"Hello Dialog!\"))\n                         .title(\"Cursive\")\n                         .button(\"Quit\", |s| s.quit()));\n\n    // Starts the event loop.\n    siv.run();\n}\n```\n\n[![Cursive dialog example](https://raw.githubusercontent.com/gyscos/cursive/main/doc/cursive_example.png)](https://github.com/gyscos/cursive/tree/main/cursive/examples/dialog.rs)\n\nCheck out the other [examples](https://github.com/gyscos/cursive/tree/main/cursive/examples) to get these results, and more:\n\n\u003cdiv\u003e\n\u003ca href=\"https://github.com/gyscos/cursive/blob/main/cursive/examples/lorem.rs\"\u003e\u003cimg src=\"https://imgur.com/hW9M9MV.png\" alt=\"lorem.rs example\", width=\"48%\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/gyscos/cursive/blob/main/cursive/examples/menubar.rs\"\u003e\u003cimg src=\"https://imgur.com/xx3lZPz.png\" alt=\"menubar.rs example\", width=\"48%\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/gyscos/cursive/blob/main/cursive/examples/select.rs\"\u003e\u003cimg src=\"https://imgur.com/couty0n.png\" alt=\"select.rs example\", width=\"48%\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/gyscos/cursive/blob/main/cursive/examples/mines/\"\u003e\u003cimg src=\"https://imgur.com/vNteYyy.png\" alt=\"mines example\", width=\"48%\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/gyscos/cursive/blob/main/cursive/examples/theme_manual.rs\"\u003e\u003cimg src=\"https://i.imgur.com/I9V5KRi.png\" alt=\"theme_manual.rs example\", width=\"48%\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/gyscos/cursive/blob/main/cursive-syntect/examples/parse.rs\"\u003e\u003cimg src=\"https://i.imgur.com/a8bfe5s.png\" alt=\"syntect example\" width=\"48%\" /\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n_(Colors may depend on your terminal configuration.)_\n\n## Tutorials\n\nThese tutorials may help you get started with cursive:\n\n* [Starting with cursive: (1/3)](https://github.com/gyscos/cursive/tree/main/doc/tutorial_1.md)\n* [Starting with cursive: (2/3)](https://github.com/gyscos/cursive/tree/main/doc/tutorial_2.md)\n* [Starting with cursive: (3/3)](https://github.com/gyscos/cursive/tree/main/doc/tutorial_3.md)\n\n## Third-party views\n\nHere are a few crates implementing new views for you to use:\n\n* [cursive-aligned-view](https://github.com/deinstapel/cursive-aligned-view): A view wrapper for gyscos/cursive views which aligns child views.\n* [cursive-async-view](https://github.com/deinstapel/cursive-async-view): A loading-screen wrapper.\n* [cursive-flexi-logger-view](https://github.com/deinstapel/cursive-flexi-logger-view): An alternative debug view using `emabee/flexi_logger`.\n* [cursive-markup](https://sr.ht/~ireas/cursive-markup-rs): A view that renders HTML or other markup.\n* [cursive-multiplex](https://github.com/deinstapel/cursive-multiplex): A tmux like multiplexer.\n* [cursive-spinner-view](https://github.com/otov4its/cursive-spinner-view): A spinner view.\n* [cursive-tabs](https://github.com/deinstapel/cursive-tabs): Tabs.\n* [cursive_calendar_view](https://github.com/BonsaiDen/cursive_calendar_view): A basic calendar view implementation.\n* [cursive_hexview](https://github.com/hellow554/cursive_hexview): A simple hexview.\n* [cursive_table_view](https://github.com/BonsaiDen/cursive_table_view): A basic table view component.\n* [cursive_tree_view](https://github.com/BonsaiDen/cursive_tree_view): A tree view implementation.\n* [cursive-hjkl](https://github.com/gamma-delta/cursive-hjkl): Wraps any view to use Vim-like `hjkl` controls.\n\n## Showcases\n\nHere are some cool applications using cursive:\n\n* [RustyChat](https://github.com/SambaDialloB/RustyChat): Chat client made using Rust and Cursive.\n* [checkline](https://github.com/sixarm/checkline-rust-crate): Checkbox line picker from stdin to stdout.\n* [clock-cli](https://github.com/TianyiShi2001/clock-cli-rs): A clock with stopwatch and countdown timer functionalities.\n* [fui](https://github.com/xliiv/fui): Add CLI \u0026 form interface to your program.\n* [game2048-rs](https://github.com/genieCS/game2048-rs): a tui game2048 using Rust and cursive.\n* [git-branchless](https://github.com/arxanas/git-branchless): Branchless workflow for Git.\n* [grin-tui](https://github.com/mimblewimble/grin): Minimal implementation of the MimbleWimble protocol.\n* [kakikun](https://github.com/file-acomplaint/kakikun): A paint and ASCII art application for the terminal.\n* [launchk](https://github.com/mach-kernel/launchk): Manage launchd agents and daemons on macOS.\n* [markline](https://github.com/sixarm/markline): Marker-based line picker from stdin to stdout.\n* [mythra](https://github.com/deven96/mythra): CLI to search for music.\n* [ncspot](https://github.com/hrkfdn/ncspot): Cross-platform ncurses Spotify client.\n* [rbmenu-tui](https://github.com/DevHyperCoder/rbmenu-tui): A TUI for bookmark management.\n* [retris](https://github.com/genieCS/retris): A simple implementation of the classic tetris game.\n* [ripasso](https://github.com/cortex/ripasso): A simple password manager written in Rust.\n* [rusty-man](https://sr.ht/~ireas/rusty-man): Browse rustdoc documentation.\n* [saci-rs](https://gitlab.com/ihercowitz/saci-rs): Simple API Client Interface.\n* [so](https://github.com/samtay/so): A terminal interface for Stack Overflow.\n* [sudoku-tui](https://github.com/TianyiShi2001/sudoku-tui): Play sudoku on the command line.\n* [tap](https://github.com/timdubbins/tap): An audio player for the terminal with fuzzy finder.\n* [ttyloop](https://github.com/gamma-delta/ttyloop): Clone of the mobile game Loop.\n* [wiki-tui](https://github.com/Builditluc/wiki-tui): A simple and easy to use Wikipedia Text User Interface\n* [glues](https://github.com/gluesql/glues): A simple note-taking app with Git, CSV, and JSON support\n\n## Goals\n\n* **Ease of use.** Simple apps should be simple. Complex apps should be manageable.\n* **Linux TTY Compatibility.** Colors may suffer, and UTF-8 may be too much, but most features *must* work properly on a Linux TTY.\n* **Flexibility.** This library should be able to handle simple UI scripts, complex real-time applications, or even games.\n    * In particular, it tries to have enough features to recreate these kind of tools:\n        * [menuconfig](http://en.wikipedia.org/wiki/Menuconfig#/media/File:Linux_x86_3.10.0-rc2_Kernel_Configuration.png)\n        * [nmtui](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/sec-Configure_a_Network_Team_Using_the_Text_User_Interface_nmtui.html)\n\n## Compatibility\n\nFirst off, terminals are messy. A small set of features is standard, but beyond that, almost every terminal has its own implementation.\n\n### Output\n\n* **Colors**: the basic 8-colors palette should be broadly supported. User-defined colors is not supported in the raw linux TTY, but should work in most terminals, although it's still kinda experimental.\n* **UTF-8**: Currently Cursive really expects a UTF-8 locale. It may eventually get patched to support window borders on other locales, but it's not a priority.\nThere is initial support for [wide characters](https://en.wikipedia.org/wiki/CJK_characters). [RTL](https://en.wikipedia.org/wiki/Right-to-left) support [is planned](https://github.com/gyscos/cursive/issues/31), but still very early.\n\n### Input\n\n* The `key_codes` example can be a useful tool to see how the library reacts to various key presses.\n* Keep in mind that if the terminal has shortcuts registered, they probably won't be transmitted to the app.\n* UTF-8 input should work fine in a unicode-enabled terminal emulator, but raw linux TTY may be more capricious.\n\n## [Contributing](CONTRIBUTING.md)\n## Alternatives\n\nSee also [ratatui](https://github.com/ratatui-org/ratatui) - and a small [comparison page](https://github.com/gyscos/cursive/wiki/Cursive-vs-tui%E2%80%90rs).\n","funding_links":[],"categories":["Libraries","库 Libraries","库"],"sub_categories":["Command-line","命令行 Command-line","命令行"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgyscos%2FCursive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgyscos%2FCursive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgyscos%2FCursive/lists"}