Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Genericise implementation of key/value tags #1

@JeanMertz

Description

@JeanMertz

Right now, you can have tags that contain a colon (:) and use the string on the left of the colon as the key of the tag, and the right side be the value:

bulletin/src/main.rs

Lines 68 to 73 in e16f06e

s.split_whitespace()
.map(|s| s.split(':').collect())
.filter(|v: &Vec<&str>| v.len() == 2)
.for_each(|v| {
values.insert(v[0].to_owned(), v[1].to_owned());
});

Some improvements to make here:

  • The character to split on should be configurable using --split-char.
  • If no split char is defined, then no splitting occurs, and and empty string is used as the default key.
  • Even if a split char is defined, any tag without the split char present, should be added to the map with an empty string as the default key.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions