squidge

Crates.iosquidge
lib.rssquidge
version0.2.3
sourcesrc
created_at2024-09-23 16:22:37.6266
updated_at2024-09-23 22:10:05.912181
descriptionsquidge shortens delimited data
homepagehttps://github.com/dhth/squidge
repositoryhttps://github.com/dhth/squidge
max_upload_size
id1384267
size11,607
Dhruv Thakur (dhth)

documentation

README

squidge

✨ Overview

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.

🛠️ Configuration

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),
};
Commit count: 15

cargo fmt