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

getdozer / dozer / 5780689709

pending completion
5780689709

push

github

web-flow
Remove s390x (#1827)

45527 of 59015 relevant lines covered (77.14%)

50795.91 hits per line

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

58.62
/dozer-cli/src/cli/types.rs
1
use clap::{Args, Parser, Subcommand};
2

3
use super::helper::{DESCRIPTION, LOGO};
4

5
#[cfg(feature = "cloud")]
6
use crate::cli::cloud::Cloud;
7
use dozer_types::constants::DEFAULT_CONFIG_PATH_PATTERNS;
8

9
#[derive(Parser, Debug)]
×
10
#[command(author, version, name = "dozer")]
11
#[command(
12
    about = format!("{} \n {}", LOGO, DESCRIPTION),
13
    long_about = None,
14
)]
15
pub struct Cli {
16
    #[arg(
17
        global = true,
18
        short = 'c',
19
        long = "config-path",
20
        default_values = DEFAULT_CONFIG_PATH_PATTERNS
21
    )]
22
    pub config_paths: Vec<String>,
×
23
    #[arg(global = true, long, hide = true)]
24
    pub config_token: Option<String>,
25
    #[arg(global = true, long, value_parser(parse_config_override))]
26
    pub config_overrides: Vec<(String, serde_json::Value)>,
×
27

28
    #[clap(subcommand)]
29
    pub cmd: Option<Commands>,
30
}
31

32
fn parse_config_override(
3✔
33
    arg: &str,
3✔
34
) -> Result<(String, serde_json::Value), Box<dyn std::error::Error + Send + Sync + 'static>> {
3✔
35
    let mut split = arg.split('=');
3✔
36
    let pointer = split.next().ok_or("missing json pointer")?;
3✔
37
    let value = split.next().ok_or("missing json value")?;
3✔
38
    Ok((pointer.to_string(), serde_json::from_str(value)?))
3✔
39
}
3✔
40

41
#[derive(Debug, Subcommand)]
×
42
pub enum Commands {
43
    #[command(
44
        about = "Initialize an app using a template",
45
        long_about = "Initialize dozer app workspace. It will generate dozer configuration and \
46
            folder structure."
47
    )]
48
    Init,
49
    #[command(
50
        about = "Clean home directory",
51
        long_about = "Clean home directory. It removes all data, schemas and other files in app \
52
            directory"
53
    )]
54
    Clean,
55
    #[command(
56
        about = "Initialize and lock schema definitions. Once initialized, schemas cannot \
57
            be changed"
58
    )]
59
    Build(Build),
60
    #[command(about = "Run App or Api Server")]
61
    Run(Run),
62
    #[command(
63
        about = "Show Sources",
64
        long_about = "Show available tables schemas in external sources"
65
    )]
66
    Connectors(ConnectorCommand),
67
    #[command(about = "Change security settings")]
68
    Security(Security),
69
    #[cfg(feature = "cloud")]
70
    #[command(about = "Deploy cloud applications")]
71
    Cloud(Cloud),
72
}
73

74
#[derive(Debug, Args)]
×
75
#[command(args_conflicts_with_subcommands = true)]
76
pub struct Build {
×
77
    #[arg(short = 'f')]
78
    pub force: Option<Option<String>>,
79
}
80

81
#[derive(Debug, Args)]
×
82
pub struct Run {
83
    #[command(subcommand)]
×
84
    pub command: RunCommands,
85
}
86

87
#[derive(Debug, Subcommand)]
×
88
pub enum RunCommands {
89
    #[command(
×
90
        about = "Run app instance",
91
        long_about = "Run app instance. App instance is responsible for ingesting data and \
92
            passing it through pipeline"
93
    )]
94
    App,
95
    #[command(
96
        about = "Run api instance",
97
        long_about = "Run api instance. Api instance runs server which creates access to \
98
            API endpoints through REST and GRPC (depends on configuration)"
99
    )]
100
    Api,
101
}
102

103
#[derive(Debug, Args)]
×
104
pub struct Security {
105
    #[command(subcommand)]
×
106
    pub command: SecurityCommands,
107
}
108

109
#[derive(Debug, Subcommand)]
×
110
pub enum SecurityCommands {
111
    #[command(
×
112
        author,
113
        version,
114
        about = "Generate master token",
115
        long_about = "Master Token can be used to create other run time tokens \
116
        that encapsulate different permissions."
117
    )]
118
    GenerateToken,
119
}
120

121
#[derive(Debug, Args)]
×
122
#[command(args_conflicts_with_subcommands = true)]
123
pub struct Deploy {
×
124
    pub target_url: String,
×
125
    #[arg(short = 'u')]
126
    pub username: Option<String>,
×
127
    #[arg(short = 'p')]
128
    pub password: Option<String>,
129
}
130

131
#[derive(Debug, Args)]
×
132
pub struct ConnectorCommand {
133
    #[arg(short = 'f')]
×
134
    pub filter: Option<String>,
135
}
136

137
#[cfg(test)]
138
mod tests {
139
    #[test]
1✔
140
    fn test_parse_config_override_string() {
1✔
141
        let arg = "/app=\"abc\"";
1✔
142
        let result = super::parse_config_override(arg).unwrap();
1✔
143
        assert_eq!(result.0, "/app");
1✔
144
        assert_eq!(result.1, serde_json::Value::String("abc".to_string()));
1✔
145
    }
1✔
146

×
147
    #[test]
1✔
148
    fn test_parse_config_override_number() {
1✔
149
        let arg = "/app=123";
1✔
150
        let result = super::parse_config_override(arg).unwrap();
1✔
151
        assert_eq!(result.0, "/app");
1✔
152
        assert_eq!(result.1, serde_json::Value::Number(123.into()));
1✔
153
    }
1✔
154

×
155
    #[test]
1✔
156
    fn test_parse_config_override_object() {
1✔
157
        let arg = "/app={\"a\": 1}";
1✔
158
        let result = super::parse_config_override(arg).unwrap();
1✔
159
        assert_eq!(result.0, "/app");
1✔
160
        assert_eq!(
1✔
161
            result.1,
1✔
162
            serde_json::json!({
1✔
163
                "a": 1
1✔
164
            })
1✔
165
        );
1✔
166
    }
1✔
167
}
×
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