use strum::{EnumDiscriminants, EnumIter, EnumMessage};
mod selected;
mod sign_as;
#[derive(Debug, Clone, interactive_clap::InteractiveClap)]
#[interactive_clap(input_context = crate::GlobalContext)]
#[interactive_clap(output_context = DeleteComponentsFromAccountContext)]
pub struct DeleteComponentsFromAccount {
account_id: near_cli_rs::types::account_id::AccountId,
#[interactive_clap(subcommand)]
delete_command: DeleteCommand,
}
#[derive(Clone)]
pub struct DeleteComponentsFromAccountContext(self::selected::ComponentContext);
impl DeleteComponentsFromAccountContext {
pub fn from_previous_context(
previous_context: crate::GlobalContext,
scope: &<DeleteComponentsFromAccount as interactive_clap::ToInteractiveClapContextScope>::InteractiveClapContextScope,
) -> color_eyre::eyre::Result<Self> {
Ok(Self(self::selected::ComponentContext {
config: previous_context.0,
account_id: scope.account_id.clone(),
components: vec![],
}))
}
}
#[derive(Debug, EnumDiscriminants, Clone, interactive_clap::InteractiveClap)]
#[interactive_clap(context = DeleteComponentsFromAccountContext)]
#[strum_discriminants(derive(EnumMessage, EnumIter))]
pub enum DeleteCommand {
#[strum_discriminants(strum(
message = "selected - Delete selected components from your account"
))]
Selected(self::selected::Selected),
#[strum_discriminants(strum(message = "all - Delete all components from your account"))]
All(All),
}
impl From<DeleteComponentsFromAccountContext> for self::selected::ComponentContext {
fn from(item: DeleteComponentsFromAccountContext) -> Self {
item.0
}
}
#[derive(Debug, Clone, interactive_clap::InteractiveClap)]
#[interactive_clap(context = DeleteComponentsFromAccountContext)]
pub struct All {
#[interactive_clap(named_arg)]
sign_as: self::sign_as::Signer,
}