Crates.io | squidge |
lib.rs | squidge |
version | 0.2.3 |
source | src |
created_at | 2024-09-23 16:22:37.6266 |
updated_at | 2024-09-23 22:10:05.912181 |
description | squidge shortens delimited data |
homepage | https://github.com/dhth/squidge |
repository | https://github.com/dhth/squidge |
max_upload_size | |
id | 1384267 |
size | 11,607 |
squidge
shortens delimited data.
use squidge::{Config, shorten_line};
let line = "module/submodule/service/lib.rs";
let result = shorten_line(&Config::default(), &line);
let expected = vec!["m", "s", "s", "lib.rs"];
assert_eq!(result, expected);
squidge
's functionality is available as a binary via sqdj.
squidge
can be configured to shorten lines in varying ways, based on its
Config
.
use squidge::Config;
use regex::Regex;
let re = Regex::new("module").unwrap();
let cfg = Config {
// Delimiter to split the line on
delimiter: "\\",
// Number of elements to ignore (for shortening) from the start
ignore_first_n: 2,
// Number of elements to ignore (for shortening) from the end
ignore_last_n: 2,
// Optional regex to determine which components to ignore while shortening
ignore_regex: Some(re),
};