commit f5afdd04a65996d99674bc14e5da47eea5ae7e7a
parent eeab1666e7e8e868438a69024e9cb99f15f8713a
Author: William Casarin <jb55@jb55.com>
Date: Thu, 2 Jan 2025 07:33:48 -0600
chrome: dont parse args twice
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/crates/notedeck_chrome/src/app.rs b/crates/notedeck_chrome/src/app.rs
@@ -114,10 +114,12 @@ impl Notedeck {
let data_path = parsed_args
.datapath
+ .clone()
.unwrap_or(data_path.as_ref().to_str().expect("db path ok").to_string());
let path = DataPath::new(&data_path);
let dbpath_str = parsed_args
.dbpath
+ .clone()
.unwrap_or_else(|| path.path(DataPathType::Db).to_str().unwrap().to_string());
let _ = std::fs::create_dir_all(&dbpath_str);
@@ -158,7 +160,7 @@ impl Notedeck {
KeyStorageType::None
};
- let mut accounts = Accounts::new(keystore, parsed_args.relays);
+ let mut accounts = Accounts::new(keystore, parsed_args.relays.clone());
let num_keys = parsed_args.keys.len();
@@ -167,10 +169,10 @@ impl Notedeck {
{
let txn = Transaction::new(&ndb).expect("txn");
- for key in parsed_args.keys {
- info!("adding account: {}", key.pubkey);
+ for key in &parsed_args.keys {
+ info!("adding account: {}", &key.pubkey);
accounts
- .add_account(key)
+ .add_account(key.clone())
.process_action(&mut unknown_ids, &ndb, &txn);
}
}
@@ -186,7 +188,6 @@ impl Notedeck {
let note_cache = NoteCache::default();
let unknown_ids = UnknownIds::default();
let tabs = Tabs::new(None);
- let parsed_args = Args::parse(args);
let app_rect_handler = AppSizeHandler::new(&path);
Self {