Return flows instead of flow_names
Assisted-by: GLM-5.3 via pi
diff --git a/src/bin/parallax/main.rs b/src/bin/parallax/main.rs
index dcffef7..59d13b3 100644
--- a/src/bin/parallax/main.rs
+++ b/src/bin/parallax/main.rs
@@ -71,8 +71,8 @@ async fn main() -> miette::Result<()> {
match command {
Commands::Run { output } => parallax.run(output.as_deref()).await?,
Commands::List => {
- for name in parallax.flow_names() {
- println!("{name}");
+ for flow in parallax.flows() {
+ println!("{}", flow.name);
}
}
}
diff --git a/src/parallax.rs b/src/parallax.rs
index 4fd5bdf..6210dd1 100644
--- a/src/parallax.rs
+++ b/src/parallax.rs
@@ -12,12 +12,10 @@ use crate::validate;
const FENNEL_LUA: &str = include_str!("../vendor/fennel.lua");
/// A flow: its name from the config and the Lua function to call when
-/// the config runs.
-struct Flow {
- name: String,
- // Called once running configs lands.
- #[allow(dead_code)]
- call: Function,
+/// the parallax runs.
+pub struct Flow {
+ pub name: String,
+ pub call: Function,
}
/// A loaded parallax: the executable form of a config. The flows and
@@ -52,12 +50,8 @@ impl Parallax {
build(lua, &table, path)
}
- pub fn flow_names(&self) -> Vec<String> {
- let mut names = Vec::with_capacity(self.flows.len());
- for flow in &self.flows {
- names.push(flow.name.clone());
- }
- names
+ pub fn flows(&self) -> &[Flow] {
+ &self.flows
}
pub fn name(&self) -> &str {