storkit: merge 441_refactor_deduplicate_get_project_root_wrappers_in_io_modules
This commit is contained in:
@@ -11,15 +11,11 @@ pub struct SearchResult {
|
|||||||
pub matches: usize,
|
pub matches: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_project_root(state: &SessionState) -> Result<PathBuf, String> {
|
|
||||||
state.get_project_root()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn search_files(
|
pub async fn search_files(
|
||||||
query: String,
|
query: String,
|
||||||
state: &SessionState,
|
state: &SessionState,
|
||||||
) -> Result<Vec<SearchResult>, String> {
|
) -> Result<Vec<SearchResult>, String> {
|
||||||
let root = get_project_root(state)?;
|
let root = state.get_project_root()?;
|
||||||
search_files_impl(query, root).await
|
search_files_impl(query, root).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,6 @@ use serde::Serialize;
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
/// Helper to get the root path (cloned) without joining
|
|
||||||
fn get_project_root(state: &SessionState) -> Result<PathBuf, String> {
|
|
||||||
state.get_project_root()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Serialize, Debug, poem_openapi::Object)]
|
#[derive(Serialize, Debug, poem_openapi::Object)]
|
||||||
pub struct CommandOutput {
|
pub struct CommandOutput {
|
||||||
pub stdout: String,
|
pub stdout: String,
|
||||||
@@ -53,7 +48,7 @@ pub async fn exec_shell(
|
|||||||
args: Vec<String>,
|
args: Vec<String>,
|
||||||
state: &SessionState,
|
state: &SessionState,
|
||||||
) -> Result<CommandOutput, String> {
|
) -> Result<CommandOutput, String> {
|
||||||
let root = get_project_root(state)?;
|
let root = state.get_project_root()?;
|
||||||
exec_shell_impl(command, args, root).await
|
exec_shell_impl(command, args, root).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user