MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / mv

Function mv

atomic-cli/src/commands/rpc.rs:3471–3494  ·  view source on GitHub ↗

`atomic mv` over MoveFile — every form (--dry-run/--force ride the request).

(args: &super::mv::Move)

Source from the content-addressed store, hash-verified

3469/// `atomic mv` over MoveFile — every form (--dry-run/--force ride the
3470/// request).
3471pub fn mv(args: &super::mv::Move) -> CliResult<bool> {
3472 let Some(session) = Service::open()? else {
3473 return Ok(false);
3474 };
3475 let request = pb::MoveFileRequest {
3476 repository: Some(session.reference.clone()),
3477 meta: None,
3478 source: args.source.clone(),
3479 destination: args.destination.clone(),
3480 dry_run: args.dry_run,
3481 force: args.force,
3482 };
3483 session.move_file(request)?;
3484 if args.dry_run {
3485 println!("Would move: {} → {}", args.source, args.destination);
3486 return Ok(true);
3487 }
3488 println!("Moving: {} → {}", args.source, args.destination);
3489 println!();
3490 print_success("Moved 1 file");
3491 println!();
3492 print_hint("Run 'atomic record' to capture this move (inode/history preserved)");
3493 Ok(true)
3494}
3495
3496/// `atomic unrecord` over Unrecord — the non-dry-run forms, bare or
3497/// with a change argument: the prefix rides the wire's ChangeRef prefix

Callers 1

runMethod · 0.85

Calls 5

openFunction · 0.85
print_successFunction · 0.85
print_hintFunction · 0.85
cloneMethod · 0.45
move_fileMethod · 0.45

Tested by

no test coverage detected