feat: add si command line interface (#37)
Rust / build (macos-latest, stable) (push) Canceled after 0s
Rust / build (ubuntu-latest, stable) (push) Canceled after 0s
Rust / build (windows-latest, stable) (push) Canceled after 0s

Reviewed-on: #37
This commit was merged in pull request #37.
This commit is contained in:
2026-11-30 00:34:44 +00:00
parent 6dfa3a2335
commit b7e1ca7c86
20 changed files with 1252 additions and 75 deletions
+18 -1
View File
@@ -3,7 +3,8 @@ use std::sync::LazyLock;
/// The application name, which derives the platform-specific directory paths.
pub const APP_NAME: &str = "Signed";
/// The application's platform identifier, the packager `identifier` in `desktop/Cargo.toml`.
pub const APP_ID: &str = "build.signed.signed";
/// Lowercased [`APP_NAME`], used in XDG paths and the macOS `~/.config` fallback.
pub const APP_NAME_LOWERCASE: &str = "signed";
@@ -72,6 +73,22 @@ pub fn documents_dir() -> PathBuf {
dirs::document_dir().unwrap_or_else(|| dirs::home_dir().unwrap_or_default())
}
/// The binary named `name` built next to the running executable, when it is there.
pub fn sibling_binary(name: &str) -> Option<PathBuf> {
let name = if std::env::consts::EXE_EXTENSION.is_empty() {
name.to_owned()
} else {
format!("{name}.{}", std::env::consts::EXE_EXTENSION)
};
let binary = std::env::current_exe().ok()?.with_file_name(name);
binary.is_file().then_some(binary)
}
/// Returns the user's binary folder, `~/.local/bin`, which most shells put on the PATH.
pub fn user_bin_dir() -> PathBuf {
home_dir().join(".local").join("bin")
}
fn config_dir() -> &'static Path {
CONFIG_DIR.as_path()
}