Skip to main content

hydro_lang/viz/
config.rs

1use clap::{Parser, ValueEnum};
2
3/// Graph output format.
4#[derive(Copy, Clone, Debug, ValueEnum)]
5pub enum GraphType {
6    /// Mermaid graphs.
7    Mermaid,
8    /// Dot (Graphviz) graphs.
9    Dot,
10    /// JSON format for Hydroscope interactive viewer.
11    Json,
12    /// Serialized IR JSON for standalone coordination analysis.
13    Ir,
14}
15
16impl GraphType {
17    /// File extension for this format.
18    pub fn file_extension(self) -> &'static str {
19        match self {
20            GraphType::Mermaid => "mmd",
21            GraphType::Dot => "dot",
22            GraphType::Json => "json",
23            GraphType::Ir => "ir.json",
24        }
25    }
26}
27
28/// Configuration for graph generation in examples.
29#[derive(Parser, Debug, Default)]
30pub struct GraphConfig {
31    /// Graph format to generate (writes to file and exits)
32    #[clap(long)]
33    pub graph: Option<GraphType>,
34
35    /// Output file path (default: `hydro_graph.{ext}`)
36    #[clap(long, short = 'o')]
37    pub output: Option<String>,
38
39    /// Use full/long labels instead of short ones
40    #[clap(long)]
41    pub long_labels: bool,
42
43    /// Don't show metadata in graph nodes
44    #[clap(long)]
45    pub no_metadata: bool,
46}