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

pomsky-lang / pomsky / 6421156176

05 Oct 2023 03:27PM UTC coverage: 80.191% (-0.1%) from 80.315%
6421156176

push

github

Aloso
chore: update deps, fix new lints

25 of 25 new or added lines in 6 files covered. (100.0%)

3267 of 4074 relevant lines covered (80.19%)

246.52 hits per line

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

33.33
/pomsky-bin/src/args/mod.rs
1
use pomsky::{features::PomskyFeatures, options::RegexFlavor};
2

3
pub(crate) use errors::ParseArgsError;
4
pub(crate) use help::print_short_usage_and_help_err;
5
pub(crate) use input::Input;
6
pub(crate) use warnings::DiagnosticSet;
7

8
use self::parse::{ArgsInner, ListKind};
9

10
mod errors;
11
mod features;
12
mod flavors;
13
mod help;
14
mod input;
15
mod parse;
16
mod warnings;
17

18
/// Compile a Pomsky expression to a regex
19
#[derive(PartialEq)]
×
20
pub(crate) struct Args {
21
    /// Pomsky expression to compile
22
    pub(crate) input: Input,
×
23
    /// Show debug information
24
    pub(crate) debug: bool,
×
25
    /// Whether output should be provided as JSON
26
    pub(crate) json: bool,
×
27
    /// Regex flavor
28
    pub(crate) flavor: Option<RegexFlavor>,
×
29
    /// Does not print a new-line at the end of the compiled regular expression
30
    pub(crate) no_new_line: bool,
×
31
    /// Set of allowed pomsky features
32
    pub(crate) allowed_features: PomskyFeatures,
×
33
    /// Set of warnings that should be emitted
34
    pub(crate) warnings: DiagnosticSet,
×
35
}
36

37
pub(super) fn parse_args() -> Result<Args, ParseArgsError> {
35✔
38
    match parse::parse_args_inner(lexopt::Parser::from_env())? {
35✔
39
        ArgsInner::Args(args) => Ok(args),
25✔
40
        ArgsInner::HelpLong => {
41
            help::print_long_help();
×
42
            std::process::exit(0)
×
43
        }
44
        ArgsInner::HelpShort => {
45
            help::print_help();
1✔
46
            std::process::exit(0)
1✔
47
        }
48
        ArgsInner::Version => {
49
            help::print_version();
1✔
50
            std::process::exit(0)
1✔
51
        }
52
        ArgsInner::List(ListKind::Shorthands) => {
53
            let s = pomsky::list_shorthands().fold(String::new(), |mut acc, (name, group_name)| {
×
54
                use std::fmt::Write;
55
                let _ = writeln!(acc, "{name:<50} {}", group_name.kind());
×
56
                acc
×
57
            });
×
58
            println!("{s}");
×
59
            std::process::exit(0)
×
60
        }
61
    }
62
}
33✔
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

© 2025 Coveralls, Inc