macro_rules! choice_enum {
($(#[$meta:meta])* $name:ident { $($variant:ident => $wire:literal),+ $(,)? }) => {
$(#[$meta])*
#[derive(Clone, Copy, Debug, PartialEq, Eq, clap::ValueEnum)]
pub enum $name {
$(#[value(name = $wire)] $variant),+
}
impl $name {
pub fn as_str(self) -> &'static str {
match self {
$(Self::$variant => $wire),+
}
}
}
};
}
choice_enum! {
CallDirection { Callers => "callers", Callees => "callees" }
}
choice_enum! {
NeighborDirection { Both => "both", Out => "out", In => "in" }
}
choice_enum! {
EdgeLane {
All => "all",
Calls => "calls",
Imports => "imports",
Inherits => "inherits",
Both => "both",
Contains => "contains",
}
}
choice_enum! {
CommunityAlgorithm { LabelPropagation => "label_propagation", Louvain => "louvain" }
}
choice_enum! {
Granularity { Module => "module", File => "file", Symbol => "symbol" }
}
choice_enum! {
ExportFormat {
NodeLink => "node_link",
Dot => "dot",
Mermaid => "mermaid",
Graphml => "graphml",
Cypher => "cypher",
Html => "html",
Svg => "svg",
}
}
choice_enum! {
VisualFormat { Html => "html", Svg => "svg" }
}
choice_enum! {
SearchLane { Hybrid => "hybrid", Semantic => "semantic", Keyword => "keyword" }
}
choice_enum! {
CommitField { Author => "author", Message => "message", All => "all" }
}
choice_enum! {
HashMode { Normalized => "normalized", Structural => "structural", StructuralLoose => "structural_loose" }
}
choice_enum! {
TelemetryWindow { Today => "today", Hour => "1h", Day => "24h", All => "all" }
}
choice_enum! {
CompressLevel {
Off => "off",
Light => "light",
Moderate => "moderate",
Aggressive => "aggressive",
Maximum => "maximum",
}
}
choice_enum! {
ProposalKind { Skill => "skill", Memory => "memory" }
}