hm_plugin_protocol/subcommand.rs
1//! Wire type for subcommand invocations.
2
3use std::collections::BTreeMap;
4
5use schemars::JsonSchema as DeriveJsonSchema;
6use serde::{Deserialize, Serialize};
7
8/// Carried into the plugin's subcommand entry point. The host has
9/// already parsed argv on the plugin's behalf using the schema the
10/// plugin declared in its manifest.
11#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, DeriveJsonSchema)]
12#[serde(deny_unknown_fields)]
13pub struct SubcommandInput {
14 /// Verb path: `["cloud", "org", "switch"]` for `hm cloud org switch`.
15 pub verb_path: Vec<String>,
16 /// Positional + option args, already parsed and JSON-encoded.
17 pub args: serde_json::Value,
18 /// `HARMONT_*` env vars + any vars the plugin declared interest in.
19 pub env: BTreeMap<String, String>,
20}