Skip to main content

bw/platform/
sync.rs

1use bitwarden_pm::PasswordManagerClient;
2use bitwarden_sync::SyncRequest;
3use clap::Args;
4
5use crate::render::CommandResult;
6
7#[derive(Args, Clone)]
8pub struct SyncArgs {
9    #[arg(short = 'f', long, help = "Force a full sync.")]
10    pub force: bool,
11
12    #[arg(long, help = "Get the last sync date.")]
13    pub last: bool,
14}
15
16impl SyncArgs {
17    /// Temporary sync implementation so you can call `bw sync` and have it do something.
18    pub(crate) async fn execute_sync(&self, client: PasswordManagerClient) -> CommandResult {
19        client
20            .sync()
21            .sync(SyncRequest {
22                exclude_subdomains: None,
23            })
24            .await?;
25
26        Ok(("Syncing complete.").into())
27    }
28}