Tauri 2 + Vue app that draws the commit graph of the repository given on the command line. Branches can be hidden one by one or by patterns, runs of plain commits fold into a dotted line, and everything is reachable from the keyboard.
38 lines
1.0 KiB
Rust
38 lines
1.0 KiB
Rust
mod filters;
|
|
mod git;
|
|
|
|
use std::path::PathBuf;
|
|
|
|
/// The repository folder: the first command line argument, or the current folder.
|
|
struct RepoArg(PathBuf);
|
|
|
|
#[tauri::command]
|
|
fn load_repo(arg: tauri::State<RepoArg>) -> Result<git::RepoData, String> {
|
|
git::load(&arg.0)
|
|
}
|
|
|
|
#[tauri::command]
|
|
fn load_filters(repo: String) -> Result<serde_json::Value, String> {
|
|
filters::load(&repo)
|
|
}
|
|
|
|
#[tauri::command]
|
|
fn save_filters(repo: String, value: serde_json::Value) -> Result<(), String> {
|
|
filters::save(&repo, value)
|
|
}
|
|
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
pub fn run() {
|
|
let path = std::env::args_os()
|
|
.nth(1)
|
|
.map(PathBuf::from)
|
|
.unwrap_or_else(|| std::env::current_dir().unwrap_or_else(|_| PathBuf::from(".")));
|
|
|
|
tauri::Builder::default()
|
|
.plugin(tauri_plugin_clipboard_manager::init())
|
|
.manage(RepoArg(path))
|
|
.invoke_handler(tauri::generate_handler![load_repo, load_filters, save_filters])
|
|
.run(tauri::generate_context!())
|
|
.expect("error while running tauri application");
|
|
}
|