use crate::CliOverridesPatch;
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PluginCommandRequest {
pub overrides: CliOverridesPatch,
}
impl PluginCommandRequest {
pub fn new() -> Self {
Self {
overrides: CliOverridesPatch::default(),
}
}
pub fn with_overrides(mut self, overrides: CliOverridesPatch) -> Self {
self.overrides = overrides;
self
}
}
impl Default for PluginCommandRequest {
fn default() -> Self {
Self::new()
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PluginHelpRequest {
pub command: Vec<String>,
pub overrides: CliOverridesPatch,
}
impl PluginHelpRequest {
pub fn new() -> Self {
Self {
command: Vec::new(),
overrides: CliOverridesPatch::default(),
}
}
pub fn command(mut self, command: impl IntoIterator<Item = impl Into<String>>) -> Self {
self.command = command.into_iter().map(Into::into).collect();
self
}
pub fn with_overrides(mut self, overrides: CliOverridesPatch) -> Self {
self.overrides = overrides;
self
}
}
impl Default for PluginHelpRequest {
fn default() -> Self {
Self::new()
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PluginMarketplaceCommandRequest {
pub overrides: CliOverridesPatch,
}
impl PluginMarketplaceCommandRequest {
pub fn new() -> Self {
Self {
overrides: CliOverridesPatch::default(),
}
}
pub fn with_overrides(mut self, overrides: CliOverridesPatch) -> Self {
self.overrides = overrides;
self
}
}
impl Default for PluginMarketplaceCommandRequest {
fn default() -> Self {
Self::new()
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PluginMarketplaceHelpRequest {
pub command: Vec<String>,
pub overrides: CliOverridesPatch,
}
impl PluginMarketplaceHelpRequest {
pub fn new() -> Self {
Self {
command: Vec::new(),
overrides: CliOverridesPatch::default(),
}
}
pub fn command(mut self, command: impl IntoIterator<Item = impl Into<String>>) -> Self {
self.command = command.into_iter().map(Into::into).collect();
self
}
pub fn with_overrides(mut self, overrides: CliOverridesPatch) -> Self {
self.overrides = overrides;
self
}
}
impl Default for PluginMarketplaceHelpRequest {
fn default() -> Self {
Self::new()
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PluginMarketplaceAddRequest {
pub source: String,
pub source_ref: Option<String>,
pub sparse_path: Option<String>,
pub overrides: CliOverridesPatch,
}
impl PluginMarketplaceAddRequest {
pub fn new(source: impl Into<String>) -> Self {
Self {
source: source.into(),
source_ref: None,
sparse_path: None,
overrides: CliOverridesPatch::default(),
}
}
pub fn source_ref(mut self, source_ref: impl Into<String>) -> Self {
let source_ref = source_ref.into();
self.source_ref = (!source_ref.trim().is_empty()).then_some(source_ref);
self
}
pub fn sparse_path(mut self, sparse_path: impl Into<String>) -> Self {
let sparse_path = sparse_path.into();
self.sparse_path = (!sparse_path.trim().is_empty()).then_some(sparse_path);
self
}
pub fn with_overrides(mut self, overrides: CliOverridesPatch) -> Self {
self.overrides = overrides;
self
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PluginMarketplaceRemoveRequest {
pub marketplace_name: String,
pub overrides: CliOverridesPatch,
}
impl PluginMarketplaceRemoveRequest {
pub fn new(marketplace_name: impl Into<String>) -> Self {
Self {
marketplace_name: marketplace_name.into(),
overrides: CliOverridesPatch::default(),
}
}
pub fn with_overrides(mut self, overrides: CliOverridesPatch) -> Self {
self.overrides = overrides;
self
}
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PluginMarketplaceUpgradeRequest {
pub marketplace_name: Option<String>,
pub overrides: CliOverridesPatch,
}
impl PluginMarketplaceUpgradeRequest {
pub fn new() -> Self {
Self {
marketplace_name: None,
overrides: CliOverridesPatch::default(),
}
}
pub fn marketplace_name(mut self, marketplace_name: impl Into<String>) -> Self {
let marketplace_name = marketplace_name.into();
self.marketplace_name = (!marketplace_name.trim().is_empty()).then_some(marketplace_name);
self
}
pub fn with_overrides(mut self, overrides: CliOverridesPatch) -> Self {
self.overrides = overrides;
self
}
}
impl Default for PluginMarketplaceUpgradeRequest {
fn default() -> Self {
Self::new()
}
}