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: impl Into<String>, to: impl Into<String>) -> Option<String> {
13 self.0.insert(from.into(), to.into())
16 pub fn replace<'a>(&self, input: impl Into<Cow<'a, str>>) -> Cow<'a, str> {
17 let input = input.into();
18 match self.0.get(input.as_ref()) {
19 Some(s) => Cow::from(s.clone()),
27 let mut map = SyntaxMapping::new();
28 map.insert("Cargo.lock", "toml");
29 map.insert(".ignore", ".gitignore");
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