{"id":15422556,"url":"https://github.com/heaths/console-rs","last_synced_at":"2026-04-10T08:30:21.512Z","repository":{"id":238225991,"uuid":"796139022","full_name":"heaths/console-rs","owner":"heaths","description":"Rust console APIs provide a testable abstraction over IO streams and support for color schemes.","archived":false,"fork":false,"pushed_at":"2024-05-06T04:15:56.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-01T10:16:49.639Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/heaths.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"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":"2024-05-05T03:45:37.000Z","updated_at":"2024-05-06T04:16:00.000Z","dependencies_parsed_at":"2024-10-20T04:28:30.535Z","dependency_job_id":null,"html_url":"https://github.com/heaths/console-rs","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"9c1a1e2766a5e41e46c0a0e37d763ac718a1c5fb"},"previous_names":["heaths/console-rs"],"tags_count":0,"template":false,"template_full_name":"heaths/template-rustlang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heaths%2Fconsole-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heaths%2Fconsole-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heaths%2Fconsole-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heaths%2Fconsole-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heaths","download_url":"https://codeload.github.com/heaths/console-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239979036,"owners_count":19728452,"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-10-01T17:38:55.434Z","updated_at":"2026-04-10T08:30:21.461Z","avatar_url":"https://github.com/heaths.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rust Console APIs\n\n[![ci](https://github.com/heaths/console-rs/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/heaths/console-rs/actions/workflows/ci.yml)\n\nThese Rust Console APIs provide a level of abstraction over virtual terminals, implement testable 'std::io::Write'\nand will support color schemes.\n\n_This name not final, but aligns with my [github.com/heaths/go-console](https://github.com/heaths/go-console) Go APIs._\n\n## Examples\n\nFor all supported versions of Windows, you can enable [ANSI escape sequences](https://learn.microsoft.com/windows/console/console-virtual-terminal-sequences).\nThis should be unnecessary for other operating systems but the function is conveniently defined for all platforms.\n\n```rust\nconsole::enable_ansi_escape_sequences(std::io::stdout()).unwrap();\nprintln!(\"\\x1b[38;5;128mHello, world!\\x1b[m\");\n```\n\nYou can also use the `Console` to write code for production and test:\n\n```rust\nuse console::console::Console;\n\nfn print(mut w: impl std::io::Write, s: \u0026str) {\n    let _ = writeln!(w, \"printing: {s}\");\n}\n\nfn main() {\n    let mut console = Console::from_system().unwrap();\n    print(console, \"sales receipt\");\n}\n\n#[cfg(test)]\nmod tests {\n    #[test]\n    fn prints_prefix() {\n        let mut stdout: Vec\u003cu8\u003e = Vec::new();\n        let mut console = Console::builder().stdout(\u0026mut stdout).build();\n        print(console, \"test\");\n\n        assert_eq!(\"printing: test\\n\".as_bytes(), stdout.as_slice());\n    }\n}\n```\n\n## License\n\nLicensed under the [MIT](LICENSE.txt) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheaths%2Fconsole-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheaths%2Fconsole-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheaths%2Fconsole-rs/lists"}