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

Function mv

atomic-cli/src/commands/rpc.rs:3472–3495  ·  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

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

Callers 1

runMethod · 0.85

Calls 5

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

Tested by

no test coverage detected