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

pkgxdev / pkgx / 12812686100

16 Jan 2025 03:56PM UTC coverage: 1.631% (-87.9%) from 89.526%
12812686100

push

github

web-flow
Merge pull request #1079 from pkgxdev/pkgx--quiet

`pkgx --quiet` suppresses resolving message

0 of 8 new or added lines in 2 files covered. (0.0%)

639 existing lines in 15 files now uncovered.

13 of 797 relevant lines covered (1.63%)

0.28 hits per line

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

0.0
/crates/cli/src/args.rs
1
use console::style;
2

3
pub enum Mode {
4
    X,
5
    Help,
6
    Version,
7
}
8

9
pub struct Flags {
10
    pub quiet: bool,
11
    pub silent: bool,
12
    pub json: bool,
13
}
14

15
pub struct Args {
16
    pub plus: Vec<String>,
17
    pub args: Vec<String>,
18
    pub find_program: bool,
19
    pub mode: Mode,
20
    pub flags: Flags,
21
}
22

UNCOV
23
pub fn parse() -> Args {
×
UNCOV
24
    let mut mode = Mode::X;
×
UNCOV
25
    let mut plus = Vec::new();
×
UNCOV
26
    let mut args = Vec::new();
×
UNCOV
27
    let mut silent: bool = false;
×
NEW
28
    let mut quiet: bool = false;
×
UNCOV
29
    let mut json: bool = false;
×
UNCOV
30
    let mut find_program = false;
×
UNCOV
31
    let mut collecting_args = false;
×
32

UNCOV
33
    for arg in std::env::args().skip(1) {
×
UNCOV
34
        if collecting_args {
×
35
            args.push(arg);
×
UNCOV
36
        } else if arg.starts_with('+') {
×
UNCOV
37
            plus.push(arg.trim_start_matches('+').to_string());
×
UNCOV
38
        } else if arg == "--" {
×
39
            find_program = false;
×
40
            collecting_args = true;
×
UNCOV
41
        } else if arg.starts_with("--") {
×
UNCOV
42
            match arg.as_str() {
×
UNCOV
43
                "--json" => {
×
UNCOV
44
                    if !silent {
×
UNCOV
45
                        eprintln!(
×
46
                            "{} use --json=v1",
47
                            style("warning: --json is not stable").yellow()
48
                        );
49
                    }
UNCOV
50
                    json = true
×
51
                }
UNCOV
52
                "--json=v1" => json = true,
×
UNCOV
53
                "--silent" => silent = true,
×
UNCOV
54
                "--help" => mode = Mode::Help,
×
UNCOV
55
                "--version" => mode = Mode::Version,
×
NEW
56
                "--quiet" => quiet = true,
×
57
                "--shellcode" => {
×
58
                    if !silent {
×
59
                        eprintln!("{}", style("⨯ migration required").red());
×
60
                        eprintln!(
×
61
                            "{} pkgx^2 is now exclusively focused on executing packages",
62
                            style("│").red()
63
                        );
64
                        eprintln!(
×
65
                            "{} you need to migrate to the new, isolated `dev` command",
66
                            style("│").red()
67
                        );
68
                        eprintln!("{} run the following:", style("│").red());
×
69
                        eprintln!(
×
70
                            "{} pkgx pkgx^1 deintegrate && pkgx dev integrate",
71
                            style("╰─➤").red()
72
                        );
73
                    }
74
                    std::process::exit(1);
×
75
                }
76
                _ => panic!("unknown argument {}", arg),
×
77
            }
78
        } else if arg.starts_with('-') {
×
79
            // spit arg into characters
80
            for c in arg.chars().skip(1) {
×
81
                match c {
×
NEW
82
                    'q' => quiet = true,
×
83
                    's' => silent = true,
×
84
                    'j' => json = true,
×
85
                    _ => panic!("unknown argument: -{}", c),
×
86
                }
87
            }
88
        } else {
89
            find_program = !arg.contains('/');
×
90
            collecting_args = true;
×
91
            args.push(arg);
×
92
        }
93
    }
94

95
    Args {
96
        plus,
97
        args,
98
        find_program,
99
        mode,
NEW
100
        flags: Flags {
×
101
            silent,
102
            json,
103
            quiet,
104
        },
105
    }
106
}
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