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}
13
14impl GraphType {
15    /// File extension for this format.
16    pub fn file_extension(self) -> &'static str {
17        match self {
18            GraphType::Mermaid => "mmd",
19            GraphType::Dot => "dot",
20            GraphType::Json => "json",
21        }
22    }
23}
24
25/// Configuration for graph generation in examples.
26#[derive(Parser, Debug, Default)]
27pub struct GraphConfig {
28    /// Graph format to generate (writes to file and exits)
29    #[clap(long)]
30    pub graph: Option<GraphType>,
31
32    /// Output file path (default: `hydro_graph.{ext}`)
33    #[clap(long, short = 'o')]
34    pub output: Option<String>,
35
36    /// Use full/long labels instead of short ones
37    #[clap(long)]
38    pub long_labels: bool,
39
40    /// Don't show metadata in graph nodes
41    #[clap(long)]
42    pub no_metadata: bool,
43}