pub struct ScriptAdapterConfig {
pub name: String,
pub detect_file: String,
pub detect_pattern: Option<String>,
pub command: String,
pub args: Vec<String>,
pub parser: OutputParser,
pub working_dir: Option<String>,
pub env: Vec<(String, String)>,
}Expand description
Definition of a custom script adapter from config.
Fields§
§name: StringUnique adapter name
detect_file: StringFile whose presence triggers detection
detect_pattern: Option<String>Optional detect pattern (glob) for more specific detection
command: StringCommand to run
args: Vec<String>Default arguments
parser: OutputParserOutput parser type
working_dir: Option<String>Working directory relative to project root (default: “.”)
env: Vec<(String, String)>Environment variables to set
Implementations§
Source§impl ScriptAdapterConfig
impl ScriptAdapterConfig
Sourcepub fn new(name: &str, detect_file: &str, command: &str) -> Self
pub fn new(name: &str, detect_file: &str, command: &str) -> Self
Create a minimal script adapter config.
Sourcepub fn with_parser(self, parser: OutputParser) -> Self
pub fn with_parser(self, parser: OutputParser) -> Self
Set the output parser.
Sourcepub fn with_working_dir(self, dir: &str) -> Self
pub fn with_working_dir(self, dir: &str) -> Self
Set working directory.
Sourcepub fn detect(&self, project_dir: &Path) -> bool
pub fn detect(&self, project_dir: &Path) -> bool
Check if this adapter detects at the given project directory.
Sourcepub fn effective_working_dir(&self, project_dir: &Path) -> PathBuf
pub fn effective_working_dir(&self, project_dir: &Path) -> PathBuf
Get the effective working directory, validated against path traversal.
Sourcepub fn full_command(&self) -> String
pub fn full_command(&self) -> String
Build the command string with args.
Trait Implementations§
Source§impl Clone for ScriptAdapterConfig
impl Clone for ScriptAdapterConfig
Source§fn clone(&self) -> ScriptAdapterConfig
fn clone(&self) -> ScriptAdapterConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ScriptAdapterConfig
impl RefUnwindSafe for ScriptAdapterConfig
impl Send for ScriptAdapterConfig
impl Sync for ScriptAdapterConfig
impl Unpin for ScriptAdapterConfig
impl UnsafeUnpin for ScriptAdapterConfig
impl UnwindSafe for ScriptAdapterConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more