reactive_graph/client/instances/entities/args/
id_and_component.rs

1use crate::client::error::CommandError;
2use crate::client::error::CommandError::NotFound;
3use crate::client::types::components::args::parse_component_ty;
4use clap::Args;
5use reactive_graph_graph::ComponentTypeId;
6use uuid::Uuid;
7
8/// Identifies a component of an entity instance.
9#[derive(Args, Debug, Clone)]
10pub(crate) struct IdAndComponentArgs {
11    /// The id of the reactive instance.
12    pub id: Uuid,
13
14    /// The fully qualified namespace of the component.
15    #[clap(name = "component", value_parser = parse_component_ty)]
16    pub component_ty: ComponentTypeId,
17}
18
19impl IdAndComponentArgs {
20    pub fn id_not_found(&self) -> CommandError {
21        NotFound(format!("The instance with the id {} was not found", &self.id))
22    }
23}