2use std::collections::HashMap;
5pub struct SyntaxMapping(HashMap<String, String>);
8 pub fn new() -> SyntaxMapping {
9 SyntaxMapping(HashMap::new())
12 pub fn insert(&mut self, from: String, to: String) -> Option<String> {
13 self.0.insert(from, to)
16 pub fn replace<'a>(&self, input: &'a str) -> Cow<'a, str> {
17 let mut out = Cow::from(input);
18 if let Some(value) = self.0.get(input) {
19 out = Cow::from(value.clone())
27 let mut map = SyntaxMapping::new();
28 map.insert("Cargo.lock".into(), "toml".into());
29 map.insert(".ignore".into(), ".gitignore".into());
31 assert_eq!("toml", map.replace("Cargo.lock"));
32 assert_eq!("other.lock", map.replace("other.lock"));
34 assert_eq!(".gitignore", map.replace(".ignore"));
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list