diff --git a/crates/context/src/lib.rs b/crates/context/src/lib.rs index e7dd4c717..827aff601 100644 --- a/crates/context/src/lib.rs +++ b/crates/context/src/lib.rs @@ -1005,8 +1005,4 @@ impl ContextManager { Ok(Some(stream)) } - - pub fn is_application_blob_installed(&self, blob_id: BlobId) -> EyreResult { - self.blob_manager.has(blob_id) - } } diff --git a/crates/network/src/stream/codec.rs b/crates/network/src/stream/codec.rs index e3e280d0f..08ecce9d8 100644 --- a/crates/network/src/stream/codec.rs +++ b/crates/network/src/stream/codec.rs @@ -25,9 +25,9 @@ impl<'a> Message<'a> { } #[derive(Debug, ThisError)] -#[error("CodecError")] #[non_exhaustive] pub enum CodecError { + #[error(transparent)] StdIo(#[from] IoError), } diff --git a/crates/node/src/interactive_cli/applications.rs b/crates/node/src/interactive_cli/applications.rs index e6cc2c479..9ac4d1d15 100644 --- a/crates/node/src/interactive_cli/applications.rs +++ b/crates/node/src/interactive_cli/applications.rs @@ -68,16 +68,21 @@ impl ApplicationCommand { } ApplicationSubcommand::Ls => { println!( - "{ind} {c1:44} | {c2:44} | Source", + "{ind} {c1:44} | {c2:44} | Installed | Source", c1 = "Application ID", c2 = "Blob ID", ); for application in node.ctx_manager.list_installed_applications()? { let entry = format!( - "{c1:44} | {c2:44} | {c3}", + "{c1:44} | {c2:44} | {c3:9} | {c4}", c1 = application.id, c2 = application.blob, - c3 = application.source + c3 = if node.ctx_manager.has_blob_available(application.blob)? { + "Yes" + } else { + "No" + }, + c4 = application.source ); for line in entry.lines() { println!("{ind} {}", line.cyan()); diff --git a/crates/node/src/interactive_cli/context.rs b/crates/node/src/interactive_cli/context.rs index 16b861a7c..d50de5655 100644 --- a/crates/node/src/interactive_cli/context.rs +++ b/crates/node/src/interactive_cli/context.rs @@ -50,7 +50,7 @@ impl ContextCommand { match self.command { Commands::Ls => { println!( - "{c1:44} | {c2:44} | Root Hash", + "{ind} {c1:44} | {c2:44} | Root Hash", c1 = "Context ID", c2 = "Application ID", ); diff --git a/crates/node/src/interactive_cli/identity.rs b/crates/node/src/interactive_cli/identity.rs index 063cd2e58..cebeeea72 100644 --- a/crates/node/src/interactive_cli/identity.rs +++ b/crates/node/src/interactive_cli/identity.rs @@ -22,6 +22,8 @@ enum IdentitySubcommands { impl IdentityCommand { pub fn run(self, node: &Node) -> Result<()> { + let ind = ">>".blue(); + match &self.subcommand { IdentitySubcommands::Ls { context_id } => { match ContextId::from_str(context_id) { @@ -41,7 +43,7 @@ impl IdentityCommand { Some((k, iter.read())) }; - println!("{:44} | Owned", "Identity"); + println!("{ind} {:44} | Owned", "Identity"); for (k, v) in first.into_iter().chain(iter.entries()) { let (k, v) = (k?, v?); @@ -53,23 +55,23 @@ impl IdentityCommand { let entry = format!( "{:44} | {}", k.public_key(), - if v.private_key.is_some() { "*" } else { " " }, + if v.private_key.is_some() { "Yes" } else { "No" }, ); for line in entry.lines() { - println!("{}", line.cyan()); + println!("{ind} {}", line.cyan()); } } } Err(_) => { - println!("Invalid context ID: {context_id}"); + println!("{ind} Invalid context ID: {context_id}"); } } } IdentitySubcommands::New => { // Handle the "new" subcommand let identity = node.ctx_manager.new_identity(); - println!("Private Key: {}", identity.cyan()); - println!("Public Key: {}", identity.public_key().cyan()); + println!("{ind} Private Key: {}", identity.cyan()); + println!("{ind} Public Key: {}", identity.public_key().cyan()); } }