git-ents.gitmain
⌘K
foforge
main.rs23 lines · 832 B · rusthistorycomment on this file
1//! `git ents`: parse, hand to [`git_ents::exe`], map error to exit code.
2
3use std::process::ExitCode;
4
5use git_ents::cli::Cli;
6
7fn main() -> ExitCode {
8 let cli: Cli = figue::from_std_args().unwrap();
9 // The `Stdout` handle, not a held `StdoutLock`: `git ents lsp`
10 // (`lens.serve`) hands stdout to `lsp-server`, whose writer thread takes
11 // the lock itself, so holding it here for the whole command would
12 // deadlock that thread. Every other command writes through the handle's
13 // own per-write lock, which is behaviorally identical for their
14 // single-threaded output.
15 let mut out = std::io::stdout();
16 match git_ents::exe::run(cli, &mut out) {
17 Ok(()) => ExitCode::SUCCESS,
18 Err(error) => {
19 eprintln!("error: {error}");
20 ExitCode::FAILURE
21 }
22 }
23}