pipedash_plugin_bitbucket/
log_dialect.rs1use pipedash_plugin_api::{
2 LineMarker,
3 LogDialect,
4 ParsedLine,
5};
6
7const COMMAND_PREFIX: &[u8] = b"+ ";
8
9pub struct BitbucketLogDialect;
10
11impl LogDialect for BitbucketLogDialect {
12 fn parse<'a>(&self, line: &'a [u8]) -> ParsedLine<'a> {
13 let is_command = line
14 .strip_prefix(COMMAND_PREFIX)
15 .is_some_and(|command| !command.trim_ascii().is_empty());
16 ParsedLine {
17 timestamp: None,
18 marker: if is_command {
19 LineMarker::Command
20 } else {
21 LineMarker::Plain
22 },
23 body: line,
24 }
25 }
26}
27
28#[cfg(test)]
29mod tests;