rathe-storage-cli 1.0.0

A CLI utility for the Rathe Storage program
use clap::{Args, Parser, Subcommand};
use solana_sdk::pubkey::Pubkey;

#[derive(Parser)]
#[clap(author, version, about, long_about = None)]
#[clap(propagate_version = true)]
pub struct CliParser {
    #[clap(subcommand)]
    pub command: Command,
}

#[derive(Subcommand)]
#[allow(clippy::enum_variant_names)]
pub enum Command {
    /// Create a storage account for a give wallet account
    CreateStorage(CreateStorageSettings),

    /// Update a requested storage with a new value
    UpdateStorage(UpdateStorageSettings),

    /// Print the data of a requested storage
    GetStorage(GetStorageSettings),

    /// Spoil a requested storage
    SpoilStorage(SpoilStorageSettings),

    /// Destroy a requested storage
    DestroyStorage(DestroyStorageSettings),
}

#[derive(Args)]
pub struct CreateStorageSettings {
    /// The path to a wallet keypair
    #[clap(value_name = "FILE_PATH")]
    pub wallet: String,

    /// A value to keep in the storage
    #[clap(short, long, value_name = "NUMBER")]
    #[clap(default_value_t = 0)]
    pub value: i32,
}

#[derive(Args)]
pub struct UpdateStorageSettings {
    /// The path to a wallet keypair
    #[clap(value_name = "FILE_PATH")]
    pub wallet: String,

    /// A value to keep in the storage
    #[clap(short, long, value_name = "NUMBER")]
    pub value: i32,
}

#[derive(Args)]
pub struct GetStorageSettings {
    /// The owner of a storage
    #[clap(value_name = "PUBKEY")]
    pub owner: Pubkey,
}

#[derive(Args)]
pub struct SpoilStorageSettings {
    /// The path to a wallet keypair
    #[clap(value_name = "FILE_PATH")]
    pub wallet: String,
}

#[derive(Args)]
pub struct DestroyStorageSettings {
    /// The path to a wallet keypair
    #[clap(value_name = "FILE_PATH")]
    pub wallet: String,
}