about summary refs log tree commit diff
path: root/web/atward/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'web/atward/src/main.rs')
-rw-r--r--web/atward/src/main.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/web/atward/src/main.rs b/web/atward/src/main.rs
index 5fe5b735ba47..08fa51272819 100644
--- a/web/atward/src/main.rs
+++ b/web/atward/src/main.rs
@@ -30,6 +30,11 @@ fn queries() -> Vec<Query> {
             pattern: Regex::new("^b/(?P<bug>\\d+)$").unwrap(),
             target: |_, captures| Some(format!("https://b.tvl.fyi/{}", &captures["bug"])),
         },
+        // Changelists (e.g. cl/42)
+        Query {
+            pattern: Regex::new("^cl/(?P<cl>\\d+)$").unwrap(),
+            target: |_, captures| Some(format!("https://cl.tvl.fyi/{}", &captures["cl"])),
+        },
     ]
 }
 
@@ -80,4 +85,15 @@ mod tests {
         assert_eq!(dispatch(&queries(), "something only mentioning b/42"), None,);
         assert_eq!(dispatch(&queries(), "b/invalid"), None,);
     }
+
+    #[test]
+    fn cl_query() {
+        assert_eq!(
+            dispatch(&queries(), "cl/42"),
+            Some("https://cl.tvl.fyi/42".to_string())
+        );
+
+        assert_eq!(dispatch(&queries(), "something only mentioning cl/42"), None,);
+        assert_eq!(dispatch(&queries(), "cl/invalid"), None,);
+    }
 }