crates/cli/git-ents/src/main.rs
main.rshistorycomment on this file
| 1 | //! `git ents`: parse, hand to [`git_ents::exe`], map error to exit code. |
| 2 | |
| 3 | use std::process::ExitCode; |
| 4 | |
| 5 | use git_ents::cli::Cli; |
| 6 | |
| 7 | fn 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 | } |