-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(vfox): pass tool options to EnvKeys hook #7447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -197,7 +197,12 @@ impl Vfox { | |
| self.get_sdk(sdk)?.get_metadata() | ||
| } | ||
|
|
||
| pub async fn env_keys(&self, sdk: &str, version: &str) -> Result<Vec<EnvKey>> { | ||
| pub async fn env_keys<T: serde::Serialize>( | ||
| &self, | ||
| sdk: &str, | ||
| version: &str, | ||
| options: T, | ||
| ) -> Result<Vec<EnvKey>> { | ||
|
Comment on lines
+200
to
+205
|
||
| debug!("Getting env keys for {sdk} version {version}"); | ||
| let sdk = self.get_sdk(sdk)?; | ||
| let sdk_info = sdk.sdk_info( | ||
|
|
@@ -210,6 +215,7 @@ impl Vfox { | |
| path: sdk_info.path.clone(), | ||
| sdk_info: BTreeMap::from([(sdk_info.name.clone(), sdk_info.clone())]), | ||
| main: sdk_info, | ||
| options, | ||
| }; | ||
| sdk.env_keys(ctx).await | ||
| } | ||
|
|
@@ -445,7 +451,14 @@ mod tests { | |
| async fn test_env_keys() { | ||
| let vfox = Vfox::test(); | ||
| // dummy plugin already exists in plugins/dummy, no need to install | ||
| let keys = vfox.env_keys("dummy", "1.0.0").await.unwrap(); | ||
| let keys = vfox | ||
| .env_keys( | ||
| "dummy", | ||
| "1.0.0", | ||
| serde_json::Value::Object(Default::default()), | ||
| ) | ||
| .await | ||
| .unwrap(); | ||
| let output = format!("{keys:?}").replace( | ||
| &vfox.install_dir.to_string_lossy().to_string(), | ||
| "<INSTALL_DIR>", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The generic parameter
Tshould have aClonebound in addition toserde::Serialize. This matches the constraint needed in the parent method and ensures the context can be cloned if needed by plugin implementations.