Skip to content

Commit

Permalink
wire defaults into clap output
Browse files Browse the repository at this point in the history
Signed-off-by: clux <[email protected]>
  • Loading branch information
clux committed Apr 1, 2024
1 parent 193b00d commit 5dc21d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ struct Kopium {
no_condition: bool,

/// Type used to represent maps via additionalProperties
#[arg(long)]
map_type: Option<MapType>,
#[arg(long, value_enum, default_value_t)]
map_type: MapType,
}

#[derive(Clone, Copy, Debug, Subcommand)]
Expand Down Expand Up @@ -203,7 +203,7 @@ impl Kopium {
log::debug!("schema: {}", serde_json::to_string_pretty(&schema)?);
let cfg = Config {
no_condition: self.no_condition,
map: self.map_type.unwrap_or_default(),
map: self.map_type,
relaxed: self.relaxed,
};
let structs = analyze(schema, kind, cfg)?
Expand Down
1 change: 1 addition & 0 deletions src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ impl Output {

/// Type used for additionalProperties maps
#[derive(clap::ValueEnum, Clone, Copy, Default, Debug)]
#[clap(rename_all = "PascalCase")]
pub enum MapType {
#[default]
BTreeMap,
Expand Down

0 comments on commit 5dc21d9

Please sign in to comment.