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

1use crate::client::error::CommandError;
2use crate::client::error::CommandError::NotFound;
3use clap::Args;
4use uuid::Uuid;
5
6/// CLI argument which identifies a property of an entity instance.
7#[derive(Args, Debug, Clone)]
8pub(crate) struct IdAndPropertyArgs {
9    /// The id of the entity instance.
10    pub id: Uuid,
11
12    /// The name of the property.
13    pub property_name: String,
14}
15
16impl IdAndPropertyArgs {
17    pub fn id_not_found(&self) -> CommandError {
18        NotFound(format!("The instance with the id {} was not found", &self.id))
19    }
20
21    pub fn property_not_found(&self) -> CommandError {
22        NotFound(format!("The instance with the id {} has no property {}", &self.id, &self.property_name))
23    }
24}