reactive_graph/client/instances/flows/args/
search.rs

1use crate::client::types::entities::args::type_id::EntityTypeIdOptions;
2use clap::Args;
3use reactive_graph_client::client::instances::flows::variables::search::variables::SearchFlowInstancesVariables;
4use uuid::Uuid;
5
6/// CLI argument for searching entity instances.
7#[derive(Args, Debug, Clone)]
8pub(crate) struct SearchFlowInstancesArgs {
9    /// The entity type.
10    #[clap(flatten)]
11    pub ty: EntityTypeIdOptions,
12
13    /// The id of the entity instance.
14    #[clap(short, long)]
15    pub id: Option<Uuid>,
16
17    /// The label of the entity instance.
18    #[clap(short, long)]
19    pub label: Option<String>,
20}
21
22impl SearchFlowInstancesArgs {}
23
24impl From<&SearchFlowInstancesArgs> for SearchFlowInstancesVariables {
25    fn from(search: &SearchFlowInstancesArgs) -> Self {
26        let ty: Option<reactive_graph_graph::EntityTypeId> = search.ty.clone().into();
27        SearchFlowInstancesVariables::builder()
28            .ty(ty.map(From::from))
29            .id(search.id.map(From::from))
30            .label(search.label.clone())
31            .build()
32    }
33}