~core/sage

a5ea94fd04873a203d0a5e2066ca4177c5102c93 — core 21 days ago cef816e
feat: better err msg
2 files changed, 16 insertions(+), 3 deletions(-)

M Cargo.toml
M src/wrapper.rs
M Cargo.toml => Cargo.toml +1 -1
@@ 2,7 2,7 @@
name = "sage"
version = "0.1.0"
edition = "2024"
license = "GPL-3"
license = "AGPL-3.0-only"
description = "A simple wrapper for `age` to add a named identity system."
homepage = "https://git.srht.e3t.cc/~core/sage"
repository = "https://git.srht.e3t.cc/~core/sage"

M src/wrapper.rs => src/wrapper.rs +15 -2
@@ 2,7 2,7 @@ use crate::db::Database;
use crate::identity::IdKeyData;
use anyhow::bail;
use pico_args::Arguments;
use std::os::unix::prelude::CommandExt;
use std::io::ErrorKind;
use std::path::{Path, PathBuf};
use std::process::{Command, exit};
use std::str::FromStr;


@@ 187,7 187,20 @@ pub fn wrapper(mut pargs: Arguments, db_path: &Path) -> anyhow::Result<()> {
        eprintln!("exec age {:?}", args);
    }

    Err(Command::new("age").args(args).exec())?;
    let mut c = match Command::new("age").args(args).spawn() {
        Ok(c) => c,
        Err(e) if e.kind() == ErrorKind::NotFound => {
            eprintln!("{e}");
            eprintln!("is `age` installed?");
            exit(0);
        }
        Err(e) => {
            return Err(e)?;
        }
    };

    c.wait()?;

    Ok(())
}