-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathdb.rs
33 lines (26 loc) · 826 Bytes
/
db.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use crate::Result;
static CUSTOM_MIMES: &[&'static str] = &[
"inode/directory",
"x-scheme-handler/http",
"x-scheme-handler/https",
"x-scheme-handler/terminal",
];
pub fn autocomplete() -> Result<()> {
use std::io::Write;
let stdout = std::io::stdout();
let mut stdout = stdout.lock();
mime_db::EXTENSIONS.iter().for_each(|(ext, _)| {
stdout.write_all(b".").unwrap();
stdout.write_all(ext.as_bytes()).unwrap();
stdout.write_all(b"\n").unwrap();
});
CUSTOM_MIMES.iter().for_each(|mime| {
stdout.write_all(mime.as_bytes()).unwrap();
stdout.write_all(b"\n").unwrap();
});
mime_db::TYPES.iter().for_each(|(mime, _, _)| {
stdout.write_all(mime.as_bytes()).unwrap();
stdout.write_all(b"\n").unwrap();
});
Ok(())
}