mirror of
https://github.com/FliegendeWurst/tmux-thumbs.git
synced 2024-11-09 16:00:35 +00:00
Add support for docker images
This commit is contained in:
parent
f0cab14a9f
commit
25a3856aac
@ -21,6 +21,7 @@ letter hint to yank the text in your tmux buffer.
|
|||||||
- Hex numbers
|
- Hex numbers
|
||||||
- Markdown urls
|
- Markdown urls
|
||||||
- IP4 addresses
|
- IP4 addresses
|
||||||
|
- Docker images
|
||||||
- kubernetes resources
|
- kubernetes resources
|
||||||
- UUIDs
|
- UUIDs
|
||||||
|
|
||||||
|
@ -35,3 +35,9 @@ home: ~/.gnu/.config.txt
|
|||||||
10.3.23.42 lorem 123.2.3.4 lorem 230.23.33.34
|
10.3.23.42 lorem 123.2.3.4 lorem 230.23.33.34
|
||||||
10.3.23.42 lorem 123.2.3.4 lorem 230.23.33.34
|
10.3.23.42 lorem 123.2.3.4 lorem 230.23.33.34
|
||||||
10.3.23.42 lorem 123.2.3.4 lorem 230.23.33.34
|
10.3.23.42 lorem 123.2.3.4 lorem 230.23.33.34
|
||||||
|
|
||||||
|
REPOSITORY TAG IMAGE ID CREATED SIZE
|
||||||
|
<none> <none> sha256:77af4d6b9913e693e8d0b4b294fa62ade6054e6b2f1ffb617ac955dd63fb0182 19 hours ago 1.089 GB
|
||||||
|
committest latest sha256:b6fa739cedf5ea12a620a439402b6004d057da800f91c7524b5086a5e4749c9f 19 hours ago 1.089 GB
|
||||||
|
<none> <none> sha256:78a85c484f71509adeaace20e72e941f6bdd2b25b4c75da8693efd9f61a37921 19 hours ago 1.089 GB
|
||||||
|
docker latest sha256:30557a29d5abc51e5f1d5b472e79b7e296f595abcf19fe6b9199dbbc809c6ff4 20 hours ago 1.089 GB
|
||||||
|
16
src/state.rs
16
src/state.rs
@ -4,11 +4,12 @@ use std::fmt;
|
|||||||
|
|
||||||
const EXCLUDE_PATTERNS: [(&'static str, &'static str); 1] = [("bash", r"[[:cntrl:]]\[([0-9]{1,2};)?([0-9]{1,2})?m")];
|
const EXCLUDE_PATTERNS: [(&'static str, &'static str); 1] = [("bash", r"[[:cntrl:]]\[([0-9]{1,2};)?([0-9]{1,2})?m")];
|
||||||
|
|
||||||
const PATTERNS: [(&'static str, &'static str); 13] = [
|
const PATTERNS: [(&'static str, &'static str); 14] = [
|
||||||
("markdown_url", r"\[[^]]*\]\(([^)]+)\)"),
|
("markdown_url", r"\[[^]]*\]\(([^)]+)\)"),
|
||||||
("url", r"((https?://|git@|git://|ssh://|ftp://|file:///)[^ ]+)"),
|
("url", r"((https?://|git@|git://|ssh://|ftp://|file:///)[^ ]+)"),
|
||||||
("diff_a", r"--- a/([^ ]+)"),
|
("diff_a", r"--- a/([^ ]+)"),
|
||||||
("diff_b", r"\+\+\+ b/([^ ]+)"),
|
("diff_b", r"\+\+\+ b/([^ ]+)"),
|
||||||
|
("docker", r"sha256:([0-9a-f]{64})"),
|
||||||
("path", r"(([.\w\-@~]+)?(/[.\w\-@]+)+)"),
|
("path", r"(([.\w\-@~]+)?(/[.\w\-@]+)+)"),
|
||||||
("color", r"#[0-9a-fA-F]{6}"),
|
("color", r"#[0-9a-fA-F]{6}"),
|
||||||
("uid", r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"),
|
("uid", r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"),
|
||||||
@ -200,6 +201,19 @@ mod tests {
|
|||||||
assert_eq!(results.last().unwrap().hint.clone().unwrap(), "a");
|
assert_eq!(results.last().unwrap().hint.clone().unwrap(), "a");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn match_docker() {
|
||||||
|
let lines = split("latest sha256:30557a29d5abc51e5f1d5b472e79b7e296f595abcf19fe6b9199dbbc809c6ff4 20 hours ago");
|
||||||
|
let custom = [].to_vec();
|
||||||
|
let results = State::new(&lines, "abcd", &custom).matches(false, false);
|
||||||
|
|
||||||
|
assert_eq!(results.len(), 1);
|
||||||
|
assert_eq!(
|
||||||
|
results.get(0).unwrap().text,
|
||||||
|
"30557a29d5abc51e5f1d5b472e79b7e296f595abcf19fe6b9199dbbc809c6ff4"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn match_bash() {
|
fn match_bash() {
|
||||||
let lines = split("path: [32m/var/log/nginx.log[m\npath: [32mtest/log/nginx-2.log:32[mfolder/.nginx@4df2.log");
|
let lines = split("path: [32m/var/log/nginx.log[m\npath: [32mtest/log/nginx-2.log:32[mfolder/.nginx@4df2.log");
|
||||||
|
Loading…
Reference in New Issue
Block a user