mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-09 17:17:03 +01:00
feat(sync): attach local folders to existing My files folders
This commit is contained in:
1 parent
800705ccb0
commit
5ca0272f15
13 files changed
+453
-1
No files matched your search
@@ -696,6 +696,15 @@ enum SyncCmd {
|
||||
/// Local directory to sync.
|
||||
path: PathBuf,
|
||||
},
|
||||
/// Sync a real local folder with an existing folder in My files.
|
||||
/// The first pass preserves local-only files and keeps differing versions.
|
||||
Attach {
|
||||
/// Existing local directory; it remains a real local directory.
|
||||
path: PathBuf,
|
||||
/// Existing folder in My files, relative to the cloud mount or inside it.
|
||||
#[arg(long)]
|
||||
to: PathBuf,
|
||||
},
|
||||
/// List this machine's synced folders.
|
||||
List,
|
||||
/// Remove a synced folder by id.
|
||||
@@ -1116,6 +1125,22 @@ fn cmd_sync(action: SyncCmd) -> Result<()> {
|
||||
.to_string();
|
||||
ok_or_bail(control_request(CtlRequest::AddSyncFolder { local_path })?)?
|
||||
}
|
||||
SyncCmd::Attach { path, to } => {
|
||||
let abs = std::fs::canonicalize(&path)
|
||||
.with_context(|| format!("resolve {}", path.display()))?;
|
||||
let local_path = abs
|
||||
.to_str()
|
||||
.ok_or_else(|| anyhow!("path is not valid UTF-8"))?
|
||||
.to_owned();
|
||||
let remote_path = to
|
||||
.to_str()
|
||||
.ok_or_else(|| anyhow!("remote path is not valid UTF-8"))?
|
||||
.to_owned();
|
||||
ok_or_bail(control_request(CtlRequest::AttachSyncFolder {
|
||||
local_path,
|
||||
remote_path,
|
||||
})?)?
|
||||
}
|
||||
SyncCmd::List => {
|
||||
let response = control_request(CtlRequest::ListSyncFolders)?;
|
||||
if emit_json(&response)? {
|
||||
|
||||
Reference in new issue
Block a user