Skip to content

v0.2.0#1

Merged
ynqa merged 3 commits intomainfrom
v0.2.0/dev
Feb 25, 2026
Merged

v0.2.0#1
ynqa merged 3 commits intomainfrom
v0.2.0/dev

Conversation

@ynqa
Copy link
Copy Markdown
Owner

@ynqa ynqa commented Feb 25, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 25, 2026 12:18
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Bumps the crate to v0.2.0 and adds new Serde helpers to support TOML (de)serialization of optional terminal style configuration, plus a dedicated attribute Serde helper for crossterm.

Changes:

  • Add option_content_style_serde modules for both termion and crossterm to serialize/deserialize Option<ContentStyle> as style strings.
  • Add crossterm_config::attribute_serde for serializing/deserializing crossterm::style::Attribute tokens.
  • Update crate version references to 0.2.0 in Cargo.toml, Cargo.lock, and README.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/termion_config/option_content_style_serde.rs New Serde adapter + tests for Option<termion_config::ContentStyle> via style-string encoding.
src/termion_config.rs Exposes the new option_content_style_serde module.
src/crossterm_config/option_content_style_serde.rs New Serde adapter + tests for Option<crossterm::style::ContentStyle> via style-string encoding.
src/crossterm_config/convert/content_style.rs Makes attribute token helpers visible for reuse by new attribute Serde module.
src/crossterm_config/convert.rs Re-exports attribute token helpers for internal crate use.
src/crossterm_config/attribute_serde.rs New Serde adapter + tests for crossterm::style::Attribute token encoding.
src/crossterm_config.rs Exposes attribute_serde and option_content_style_serde.
README.md Updates dependency examples to termcfg = "0.2.0".
Cargo.toml Bumps package version to 0.2.0.
Cargo.lock Updates locked version to 0.2.0.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

fn parse_attribute_token(token: &str) -> Result<Attribute, StyleError> {
pub fn parse_attribute_token(token: &str) -> Result<Attribute, StyleError> {
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parse_attribute_token is re-exported as pub(crate) from crossterm_config::convert. Consider making this function pub(crate) as well (instead of pub) to keep the visibility as narrow as possible and avoid accidentally expanding the API surface later.

Suggested change
pub fn parse_attribute_token(token: &str) -> Result<Attribute, StyleError> {
pub(crate) fn parse_attribute_token(token: &str) -> Result<Attribute, StyleError> {

Copilot uses AI. Check for mistakes.
}

fn attribute_to_token(attribute: Attribute) -> Option<&'static str> {
pub fn attribute_to_token(attribute: Attribute) -> Option<&'static str> {
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attribute_to_token is only used internally and re-exported as pub(crate) from crossterm_config::convert. Consider changing this function’s visibility from pub to pub(crate) (or similarly minimal) to avoid unnecessarily widening visibility.

Suggested change
pub fn attribute_to_token(attribute: Attribute) -> Option<&'static str> {
pub(crate) fn attribute_to_token(attribute: Attribute) -> Option<&'static str> {

Copilot uses AI. Check for mistakes.

assert!(serialized.contains("fg=lightblue"));
assert!(serialized.contains("attr=bold"));
}
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The option wrapper’s serialization behavior for None isn’t covered here. Adding a test that Config { style: None } serializes without emitting a style key (matching the crossterm variant) would help prevent regressions in how None is represented in TOML.

Suggested change
}
}
#[test]
fn serializes_none_without_style_key() {
let config = Config { style: None };
let serialized = toml::to_string(&config).unwrap();
// Ensure that when style is None, the field is omitted entirely
assert!(!serialized.contains("style"));
}

Copilot uses AI. Check for mistakes.
@ynqa ynqa merged commit 14943c3 into main Feb 25, 2026
12 checks passed
@ynqa ynqa deleted the v0.2.0/dev branch February 25, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants