feat(base): add GetPluginSettingsPath API and CLI command
This commit is contained in:
parent
e7390f6549
commit
7bd0313b30
|
|
@ -34,6 +34,7 @@ Commands wrapped in this crate but currently unhandled/unsupported by this KiCad
|
||||||
Deferred manual/runtime verification (implemented after 2026-02-20 while user unavailable):
|
Deferred manual/runtime verification (implemented after 2026-02-20 while user unavailable):
|
||||||
|
|
||||||
- `GetKiCadBinaryPath`
|
- `GetKiCadBinaryPath`
|
||||||
|
- `GetPluginSettingsPath`
|
||||||
|
|
||||||
## KiCad v10 RC1.1 API Completion Matrix
|
## KiCad v10 RC1.1 API Completion Matrix
|
||||||
|
|
||||||
|
|
@ -53,12 +54,12 @@ Legend:
|
||||||
|
|
||||||
| Section | Proto Commands | Implemented | Coverage |
|
| Section | Proto Commands | Implemented | Coverage |
|
||||||
| --- | ---: | ---: | ---: |
|
| --- | ---: | ---: | ---: |
|
||||||
| Common (base) | 6 | 5 | 83% |
|
| Common (base) | 6 | 6 | 100% |
|
||||||
| Common editor/document | 23 | 15 | 65% |
|
| Common editor/document | 23 | 15 | 65% |
|
||||||
| Project manager | 5 | 3 | 60% |
|
| Project manager | 5 | 3 | 60% |
|
||||||
| Board editor (PCB) | 22 | 20 | 91% |
|
| Board editor (PCB) | 22 | 20 | 91% |
|
||||||
| Schematic editor (dedicated proto commands) | 0 | 0 | n/a |
|
| Schematic editor (dedicated proto commands) | 0 | 0 | n/a |
|
||||||
| **Total** | **56** | **43** | **77%** |
|
| **Total** | **56** | **44** | **79%** |
|
||||||
|
|
||||||
### Common (base)
|
### Common (base)
|
||||||
|
|
||||||
|
|
@ -69,7 +70,7 @@ Legend:
|
||||||
| `GetKiCadBinaryPath` | Implemented | `KiCadClient::get_kicad_binary_path_raw`, `KiCadClient::get_kicad_binary_path` |
|
| `GetKiCadBinaryPath` | Implemented | `KiCadClient::get_kicad_binary_path_raw`, `KiCadClient::get_kicad_binary_path` |
|
||||||
| `GetTextExtents` | Implemented | `KiCadClient::get_text_extents_raw`, `KiCadClient::get_text_extents` |
|
| `GetTextExtents` | Implemented | `KiCadClient::get_text_extents_raw`, `KiCadClient::get_text_extents` |
|
||||||
| `GetTextAsShapes` | Implemented | `KiCadClient::get_text_as_shapes_raw`, `KiCadClient::get_text_as_shapes` |
|
| `GetTextAsShapes` | Implemented | `KiCadClient::get_text_as_shapes_raw`, `KiCadClient::get_text_as_shapes` |
|
||||||
| `GetPluginSettingsPath` | Not yet | - |
|
| `GetPluginSettingsPath` | Implemented | `KiCadClient::get_plugin_settings_path_raw`, `KiCadClient::get_plugin_settings_path` |
|
||||||
|
|
||||||
### Common editor/document
|
### Common editor/document
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,12 @@ Resolve KiCad binary path (default `kicad-cli`):
|
||||||
cargo run --bin kicad-ipc-cli -- kicad-binary-path --binary-name kicad-cli
|
cargo run --bin kicad-ipc-cli -- kicad-binary-path --binary-name kicad-cli
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Resolve plugin settings path (default identifier `kicad-ipc-rust`):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo run --bin kicad-ipc-cli -- plugin-settings-path --identifier kicad-ipc-rust
|
||||||
|
```
|
||||||
|
|
||||||
List open PCB docs:
|
List open PCB docs:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ const KICAD_API_TOKEN_ENV: &str = "KICAD_API_TOKEN";
|
||||||
const CMD_PING: &str = "kiapi.common.commands.Ping";
|
const CMD_PING: &str = "kiapi.common.commands.Ping";
|
||||||
const CMD_GET_VERSION: &str = "kiapi.common.commands.GetVersion";
|
const CMD_GET_VERSION: &str = "kiapi.common.commands.GetVersion";
|
||||||
const CMD_GET_KICAD_BINARY_PATH: &str = "kiapi.common.commands.GetKiCadBinaryPath";
|
const CMD_GET_KICAD_BINARY_PATH: &str = "kiapi.common.commands.GetKiCadBinaryPath";
|
||||||
|
const CMD_GET_PLUGIN_SETTINGS_PATH: &str = "kiapi.common.commands.GetPluginSettingsPath";
|
||||||
const CMD_GET_NET_CLASSES: &str = "kiapi.common.commands.GetNetClasses";
|
const CMD_GET_NET_CLASSES: &str = "kiapi.common.commands.GetNetClasses";
|
||||||
const CMD_GET_TEXT_VARIABLES: &str = "kiapi.common.commands.GetTextVariables";
|
const CMD_GET_TEXT_VARIABLES: &str = "kiapi.common.commands.GetTextVariables";
|
||||||
const CMD_EXPAND_TEXT_VARIABLES: &str = "kiapi.common.commands.ExpandTextVariables";
|
const CMD_EXPAND_TEXT_VARIABLES: &str = "kiapi.common.commands.ExpandTextVariables";
|
||||||
|
|
@ -84,6 +85,7 @@ const CMD_SAVE_SELECTION_TO_STRING: &str = "kiapi.common.commands.SaveSelectionT
|
||||||
|
|
||||||
const RES_GET_VERSION: &str = "kiapi.common.commands.GetVersionResponse";
|
const RES_GET_VERSION: &str = "kiapi.common.commands.GetVersionResponse";
|
||||||
const RES_PATH_RESPONSE: &str = "kiapi.common.commands.PathResponse";
|
const RES_PATH_RESPONSE: &str = "kiapi.common.commands.PathResponse";
|
||||||
|
const RES_STRING_RESPONSE: &str = "kiapi.common.commands.StringResponse";
|
||||||
const RES_NET_CLASSES_RESPONSE: &str = "kiapi.common.commands.NetClassesResponse";
|
const RES_NET_CLASSES_RESPONSE: &str = "kiapi.common.commands.NetClassesResponse";
|
||||||
const RES_TEXT_VARIABLES: &str = "kiapi.common.project.TextVariables";
|
const RES_TEXT_VARIABLES: &str = "kiapi.common.project.TextVariables";
|
||||||
const RES_EXPAND_TEXT_VARIABLES_RESPONSE: &str =
|
const RES_EXPAND_TEXT_VARIABLES_RESPONSE: &str =
|
||||||
|
|
@ -361,6 +363,28 @@ impl KiCadClient {
|
||||||
Ok(response.path)
|
Ok(response.path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn get_plugin_settings_path_raw(
|
||||||
|
&self,
|
||||||
|
identifier: impl Into<String>,
|
||||||
|
) -> Result<prost_types::Any, KiCadError> {
|
||||||
|
let command = common_commands::GetPluginSettingsPath {
|
||||||
|
identifier: identifier.into(),
|
||||||
|
};
|
||||||
|
let response = self
|
||||||
|
.send_command(envelope::pack_any(&command, CMD_GET_PLUGIN_SETTINGS_PATH))
|
||||||
|
.await?;
|
||||||
|
response_payload_as_any(response, RES_STRING_RESPONSE)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn get_plugin_settings_path(
|
||||||
|
&self,
|
||||||
|
identifier: impl Into<String>,
|
||||||
|
) -> Result<String, KiCadError> {
|
||||||
|
let payload = self.get_plugin_settings_path_raw(identifier).await?;
|
||||||
|
let response: common_commands::StringResponse = decode_any(&payload, RES_STRING_RESPONSE)?;
|
||||||
|
Ok(response.response)
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn get_open_documents(
|
pub async fn get_open_documents(
|
||||||
&self,
|
&self,
|
||||||
document_type: DocumentType,
|
document_type: DocumentType,
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue