#[arg(short = 'e', long, value_parser = parse_encoding)]
encoding: Option<&'static Encoding>,
+ /// Password for decryption, with or without what SPSS calls "password encryption".
+ ///
+ /// Specify only for an encrypted system file.
+ #[clap(short, long)]
+ password: Option<String>,
+
/// Maximum number of cases to print.
#[arg(short = 'c', long = "cases")]
max_cases: Option<u64>,
}
impl Convert {
- fn warn(warning: anyhow::Error) {
- eprintln!("warning: {warning}");
- }
-
fn run(self) -> Result<()> {
+ fn warn(warning: anyhow::Error) {
+ eprintln!("warning: {warning}");
+ }
+
let (dictionary, _, cases) = ReaderOptions::new()
- .open_file(&self.input, Self::warn)?
+ .with_encoding(self.encoding)
+ .with_password(self.password.clone())
+ .open_file(&self.input, warn)?
.into_parts();
let writer = match self.output {
Some(path) => Box::new(File::create(path)?) as Box<dyn Write>,