hydro_lang/
graph_util.rs

1#[cfg(feature = "viz")]
2use clap::{Parser, ValueEnum};
3
4/// Enum for choosing between mermaid, dot, and reactflow graph writing.
5#[cfg(feature = "viz")]
6#[derive(Copy, Clone, Debug, ValueEnum)]
7pub enum GraphType {
8    /// Mermaid graphs.
9    Mermaid,
10    /// Dot (Graphviz) graphs.
11    Dot,
12    /// Reactflow.js interactive graphs.
13    Reactflow,
14}
15
16#[cfg(feature = "viz")]
17impl std::fmt::Display for GraphType {
18    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19        write!(f, "{:?}", self)
20    }
21}
22
23/// Configuration for graph generation in examples.
24#[cfg(feature = "viz")]
25#[derive(Parser, Debug, Default)]
26pub struct GraphConfig {
27    /// Graph format to generate and display
28    #[clap(long)]
29    pub graph: Option<GraphType>,
30
31    /// Don't show metadata in graph nodes
32    #[clap(long)]
33    pub no_metadata: bool,
34
35    /// Don't show location groups
36    #[clap(long)]
37    pub no_location_groups: bool,
38
39    /// Don't include tee IDs in nodes
40    #[clap(long)]
41    pub no_tee_ids: bool,
42
43    /// Use full/long labels instead of short ones
44    #[clap(long)]
45    pub long_labels: bool,
46}