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

Function print_reservation

atomic-cli/src/commands/agent/owner.rs:677–700  ·  view source on GitHub ↗
(response: OwnerResponse, json: bool)

Source from the content-addressed store, hash-verified

675}
676
677fn print_reservation(response: OwnerResponse, json: bool) -> CliResult<()> {
678 let (turn, committed) = match response {
679 OwnerResponse::ProvenanceTurn { turn, committed } => (turn, committed),
680 other => return Err(unexpected_response("reserve", other).into()),
681 };
682 let output = ReserveOutput {
683 protocol_version: PROTOCOL_VERSION,
684 committed,
685 turn,
686 };
687 if json {
688 println!(
689 "{}",
690 serde_json::to_string(&output).map_err(anyhow::Error::from)?
691 );
692 } else {
693 println!(
694 "reserved provenance turn {} generation {} (committed)",
695 output.turn.provenance_id.get(),
696 output.turn.generation
697 );
698 }
699 Ok(())
700}
701
702fn unexpected_response(operation: &str, response: OwnerResponse) -> anyhow::Error {
703 match response {

Callers 1

runMethod · 0.85

Calls 1

unexpected_responseFunction · 0.85

Tested by

no test coverage detected