{"id":13438655,"url":"https://github.com/vitiral/termstyle","last_synced_at":"2026-03-16T22:03:35.039Z","repository":{"id":57669520,"uuid":"116827246","full_name":"vitiral/termstyle","owner":"vitiral","description":" create and test the style and formatting of text in your terminal applications","archived":false,"fork":false,"pushed_at":"2018-02-12T22:43:23.000Z","size":45,"stargazers_count":18,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-11T13:33:35.278Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.rs/termstyle","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vitiral.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-09T14:34:54.000Z","updated_at":"2023-09-08T17:34:56.000Z","dependencies_parsed_at":"2022-09-26T20:40:58.119Z","dependency_job_id":null,"html_url":"https://github.com/vitiral/termstyle","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitiral%2Ftermstyle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitiral%2Ftermstyle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitiral%2Ftermstyle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitiral%2Ftermstyle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vitiral","download_url":"https://codeload.github.com/vitiral/termstyle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234444611,"owners_count":18833658,"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":[],"created_at":"2024-07-31T03:01:07.274Z","updated_at":"2025-11-07T22:04:25.611Z","avatar_url":"https://github.com/vitiral.png","language":"Rust","funding_links":[],"categories":["Libraries","库","库 Libraries"],"sub_categories":["Command-line","命令行","命令行 Command-line"],"readme":"- **description**: create and test the style and formatting of text in your\n  terminal applications\n- **docs**: https://docs.rs/termstyle\n\n**termstyle** is a library that aims to make it easy to build (and test)\n**formatted** and **styled** command line applications. It supports the following \"elements\":\n- **styled-text**\n    - italic\n    - bold\n    - colors\n- **tables**: composed of styled text with identical width columns\n\nText can be constructed programatically by pushing tokens onto a vector and\nthen `paint()`ing them, or by parsing a `yaml` file. This allows you to easily\nwrite unit tests for your command line applications.\n\n## Example\nGiven the following config (written in yaml):\n```yaml\n- {t: \"-- EXAMPLE --\\n\", b: true}\n- \"This is a regular string with a newline\\n\"\n- \"This does not have a newline, but \"\n- {t: \"this is red\", c: red}\n- \", but this is NOT red!\\n\"\n- \"Bold is easy like this: \"\n- {t: \"see I'm bold!!\\n\", b: true}\n- And so is multiple settings\n- # long-form\n  t: |\n\n      bold AND green!\n      and even multiple lines :) :)\n  b: true\n  c: green\n- [\"\\nyou can group multiple text items \", {t: \"on one line!\", b: true}]\n- \"\\nGrouping things in one line is necessary for tables\\n\"\n- \"Notice that some cells are grouped and some are not.\\n\\n\"\n- [{t: \"# Table\", b: true}, \"\\n\"]\n-\n  table:\n  - [[\"header \", {t: \"col1\", b: true}] ,\"| header col2\"]\n  - [\"row col1\", [\"| \", {t: \"row col2\", c: green}]]\n```\n\nUse the following to render it:\n```rust\nlet els = termstyle::from_str(serde_yaml::from_str, example).unwrap();\ntermstyle::paint(\u0026mut ::std::io::stdout(), \u0026els).unwrap();\n```\n\nWhich gets rendered as:\n\n![rendered](img/example.png)\n\nYou can also create the \"stream of elements\" using the types provided by the\nlibrary.  For more information, see the\n[library docs](https://docs.rs/termstyle).\n\n\n# LICENSE\n\nThe source code is Licensed under either of\n\n* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or\n  http://www.apache.org/licenses/LICENSE-2.0)\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or\n  http://opensource.org/licenses/MIT)\n\nat your option.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall\nbe dual licensed as above, without any additional terms or conditions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitiral%2Ftermstyle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitiral%2Ftermstyle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitiral%2Ftermstyle/lists"}