Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rote/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rote-mux"
version = "0.1.2"
version = "0.1.3"
edition = "2024"
description = "A terminal multiplexer for monitoring and managing multiple processes"
license = "MIT"
Expand Down
20 changes: 16 additions & 4 deletions rote/src/bin/rote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,17 @@ struct Args {
}

#[tokio::main]
async fn main() -> anyhow::Result<()> {
async fn main() {
if let Err(e) = run().await {
eprintln!("error: {e}");
for cause in e.chain().skip(1) {
eprintln!(" caused by: {cause}");
}
std::process::exit(1);
}
}

async fn run() -> anyhow::Result<()> {
let args = Args::parse();

if args.generate_example {
Expand All @@ -41,12 +51,14 @@ async fn main() -> anyhow::Result<()> {

let yaml_dir = config_path
.parent()
.ok_or_else(|| anyhow::anyhow!("Failed to determine config file directory"))?
.ok_or_else(|| anyhow::anyhow!("failed to determine config file directory"))?
.to_path_buf();

let yaml_str = fs::read_to_string(&config_path).context("Reading the config file")?;
let yaml_str = fs::read_to_string(&config_path)
.with_context(|| format!("failed to read config file '{}'", config_path.display()))?;

let config: Config = serde_yaml::from_str(&yaml_str).context("Parsing the config file")?;
let config: Config =
serde_yaml::from_str(&yaml_str).context("failed to parse config file as YAML")?;

rote_mux::run(config, args.services, yaml_dir).await?;

Expand Down