1use wechat_profile::{KeyFile, ListQuery, ProfileLocation, ProfileReader, ReadOptions};
3
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let args: Vec<_> = std::env::args().skip(1).collect();
6 if args.len() != 3 || args[0] != "--stopped-or-consistent-copy" {
7 return Err("usage: contacts --stopped-or-consistent-copy ACCOUNT_ROOT KEYS_FILE".into());
8 }
9 let location = ProfileLocation::new(&args[1])?;
10 let keys = KeyFile::load(&args[2])?;
11 let reader = ProfileReader::open(
12 location,
13 keys,
14 ReadOptions {
15 stopped_or_consistent_snapshot: true,
16 ..Default::default()
17 },
18 )?;
19 println!(
20 "{} contacts",
21 reader.contacts(&ListQuery::default())?.items.len()
22 );
23 Ok(())
24}