cli/command/
return_code.rs1use super::CommandError;
6use crate::{cli::SubCommand, context::ContextCache, convert::from_str_to_tpm_rc, device::Device};
7use argh::FromArgs;
8use std::{cell::RefCell, rc::Rc};
9use tpm2_protocol::data::TpmRc;
10
11#[derive(FromArgs, Debug)]
13#[argh(subcommand, name = "return-code")]
14pub struct ReturnCode {
15 #[argh(positional, from_str_fn(from_str_to_tpm_rc))]
17 pub rc: TpmRc,
18}
19
20impl SubCommand for ReturnCode {
21 fn run(
22 &self,
23 _device: Option<Rc<RefCell<Device>>>,
24 context: &mut ContextCache,
25 _plain: bool,
26 ) -> Result<(), CommandError> {
27 writeln!(context.writer, "{}", self.rc)?;
28 Ok(())
29 }
30
31 fn is_local(&self) -> bool {
32 true
33 }
34}