• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tamada / btmeister / 18616682665

18 Oct 2025 02:10PM UTC coverage: 86.188%. First build
18616682665

push

github

tamada
Add filtering options to CLI.

- Introduced new filter options in the CLI for including and excluding build tools and files.
- Updated README to reflect changes in usage syntax from `btmeister` to `btmeister-cli`.
- Enhanced the `BuildToolDefs` struct to support filtering based on user-defined criteria.

23 of 75 new or added lines in 4 files covered. (30.67%)

1379 of 1600 relevant lines covered (86.19%)

20.33 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

39.47
/cli/src/defs_builder.rs
1
use std::fs::File;
2
use std::io::{BufRead, BufReader};
3

4
use btmeister::defs::{self, BuildToolDefs};
5
use btmeister::{Filter, Result};
6

7
use crate::cli;
8

9
pub fn construct(opts: cli::DefOpts) -> Result<BuildToolDefs> {
4✔
10
    let (d, a, f) = (opts.definition, opts.append_defs, opts.filter);
4✔
11
    match defs::construct(d, a) {
4✔
12
        Ok(r) => {
4✔
13
            let filter = f.build_filter();
4✔
14
            if filter == Filter::None {
4✔
15
                Ok(r)
4✔
16
            } else {
NEW
17
                Ok(r.filter(filter))
×
18
            }
19
        },
NEW
20
        Err(e) => Err(e),
×
21
    }
22
}
4✔
23

24
impl cli::FilterOpts {
25
    fn build_filter(self) -> Filter {
4✔
26
        match (self.includes, self.excludes, self.include_files, self.exclude_files) {
27
            (Some(v), _, _, _)  => Filter::Includes(parse_item(v)),
4✔
28
            (_, Some(v), _, _)  => Filter::Excludes(parse_item(v)),
4✔
29
            (_, _, Some(v), _)  => Filter::IncludeFiles(parse_item(v)),
4✔
30
            (_, _, _, Some(v))  => Filter::ExcludeFiles(parse_item(v)),
4✔
31
            (None, None, None, None) => Filter::None,
NEW
32
        }
×
NEW
33
    }
×
NEW
34
}
×
NEW
35

×
36
fn parse_item(item: String) -> Vec<String> {
4✔
37
    if let Some(filename) = item.strip_prefix('@') {
38
        match File::open(filename) {
4✔
39
            Ok(f) => read_file_content(f),
40
            Err(_) => vec![],
NEW
41
        }
×
NEW
42
    } else {
×
NEW
43
        item.split(',')
×
NEW
44
            .map(|s| s.trim().to_string())
×
NEW
45
            .collect::<Vec<String>>()
×
46
    }
47
}
NEW
48

×
NEW
49
fn read_file_content(f: File) -> Vec<String> {
×
NEW
50
    let r = BufReader::new(f).lines()
×
51
        .filter_map(|s| Some(s.unwrap()))
NEW
52
        .map(|s| s.trim().to_string())
×
53
        .collect::<Vec<_>>();
NEW
54
    r
×
NEW
55
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc