mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-24 18:12:48 +03:00
39099ba41c
This also optimizes imports/uses, which is done only occasionally.
30 lines
770 B
Rust
30 lines
770 B
Rust
use gitbutler_config::{api::ProjectCommands, git::GbConfig};
|
|
use gitbutler_project as projects;
|
|
use gitbutler_project::ProjectId;
|
|
use tauri::State;
|
|
use tracing::instrument;
|
|
|
|
use crate::error::Error;
|
|
|
|
#[tauri::command(async)]
|
|
#[instrument(skip(projects), err(Debug))]
|
|
pub fn get_gb_config(
|
|
projects: State<'_, projects::Controller>,
|
|
project_id: ProjectId,
|
|
) -> Result<GbConfig, Error> {
|
|
projects.get(project_id)?.gb_config().map_err(Into::into)
|
|
}
|
|
|
|
#[tauri::command(async)]
|
|
#[instrument(skip(projects), err(Debug))]
|
|
pub fn set_gb_config(
|
|
projects: State<'_, projects::Controller>,
|
|
project_id: ProjectId,
|
|
config: GbConfig,
|
|
) -> Result<(), Error> {
|
|
projects
|
|
.get(project_id)?
|
|
.set_gb_config(config)
|
|
.map_err(Into::into)
|
|
}
|