1use bitwarden_sync::SyncRequest;
2use clap::Args;
3
4use crate::{
5 client_state::{BwCommand, LoggedIn},
6 render::CommandResult,
7};
8
9#[derive(Args, Clone)]
10pub struct SyncArgs {
11 #[arg(short = 'f', long, help = "Force a full sync.")]
12 pub force: bool,
13
14 #[arg(long, help = "Get the last sync date.")]
15 pub last: bool,
16}
17
18impl BwCommand for SyncArgs {
19 type Client = LoggedIn;
20
21 async fn run(self, LoggedIn { user, .. }: LoggedIn) -> CommandResult {
22 user.sync()
23 .sync(SyncRequest {
24 exclude_subdomains: None,
25 })
26 .await?;
27
28 Ok(("Syncing complete.").into())
29 }
30}