Implement --omit-informal for opentally convert
This commit is contained in:
parent
3ceaf67091
commit
46654f8c5a
@ -56,9 +56,13 @@ pub struct SubcmdOptions {
|
|||||||
#[clap(help_heading=Some("PREFERENCE VALIDATION"), long)]
|
#[clap(help_heading=Some("PREFERENCE VALIDATION"), long)]
|
||||||
require_sequential: bool,
|
require_sequential: bool,
|
||||||
|
|
||||||
/// Require strict ordering of preferences
|
/// Require strict ordering of preferences (disallow equal rankings)
|
||||||
#[clap(help_heading=Some("PREFERENCE VALIDATION"), long)]
|
#[clap(help_heading=Some("PREFERENCE VALIDATION"), long)]
|
||||||
require_strict_order: bool,
|
require_strict_order: bool,
|
||||||
|
|
||||||
|
/// Do not output wholly informal ballots
|
||||||
|
#[clap(help_heading=Some("PREFERENCE VALIDATION"), long)]
|
||||||
|
omit_informal: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Entrypoint for subcommand
|
/// Entrypoint for subcommand
|
||||||
@ -126,6 +130,11 @@ pub fn main(mut cmd_opts: SubcmdOptions) -> Result<(), i32> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cmd_opts.omit_informal {
|
||||||
|
// Remove wholly informal ballots from output
|
||||||
|
election.ballots.retain(|b| !b.preferences.is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
// Write output file
|
// Write output file
|
||||||
let output = File::create(cmd_opts.outfile).expect("IO Error");
|
let output = File::create(cmd_opts.outfile).expect("IO Error");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user