70 lines
1.6 KiB
Rust
70 lines
1.6 KiB
Rust
use clap::{Args, Parser, Subcommand, ValueEnum};
|
|
|
|
use crate::{commands::connect::config_option::ConfigOptionCli, interactive_variable};
|
|
|
|
#[derive(Parser)]
|
|
#[command(version, about, long_about = None)]
|
|
pub struct Cli {
|
|
#[command(subcommand)]
|
|
pub command: Commands,
|
|
|
|
/// Specify data file path
|
|
#[arg(short, long)]
|
|
pub data: Option<String>,
|
|
}
|
|
|
|
#[derive(Subcommand)]
|
|
pub enum Commands {
|
|
/// Configures downpour endpoints
|
|
Connect {
|
|
#[arg(short, long)]
|
|
name: Option<String>,
|
|
#[command(subcommand)]
|
|
option: ConfigOptionCli,
|
|
},
|
|
/// Uploads new game version to depot
|
|
Upload {
|
|
#[clap(flatten)]
|
|
info: UploadInfoCli,
|
|
#[arg(short, long)]
|
|
/// Alias of a given connection
|
|
name: Option<String>,
|
|
},
|
|
}
|
|
|
|
#[derive(Args)]
|
|
pub struct UploadInfo {
|
|
pub path: String,
|
|
pub game_id: String,
|
|
pub version_id: String,
|
|
}
|
|
#[derive(Args)]
|
|
pub struct UploadInfoCli {
|
|
/// Relative path to new version files
|
|
#[arg(short, long, default_value_t = String::from("."))]
|
|
pub path: String,
|
|
/// ID of game to attach to
|
|
#[arg(short, long)]
|
|
pub game_id: Option<String>,
|
|
/// Version ID to attach to
|
|
#[arg(short, long)]
|
|
pub version_id: Option<String>,
|
|
}
|
|
impl UploadInfoCli {
|
|
pub fn interactive_configure(self) -> UploadInfo {
|
|
let path = self.path;
|
|
interactive_variable!(self, game_id, "Game ID");
|
|
interactive_variable!(self, version_id, "Version ID");
|
|
UploadInfo {
|
|
path,
|
|
game_id,
|
|
version_id,
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(ValueEnum, Copy, Clone, Debug, PartialEq, Eq)]
|
|
pub enum UploadStyle {
|
|
S3,
|
|
}
|