feat: Add name default and manual configuration
This commit is contained in:
+29
-7
@@ -1,6 +1,6 @@
|
||||
use clap::{Args, Parser, Subcommand, ValueEnum};
|
||||
|
||||
use crate::commands::connect::config_option::ConfigOptionCli;
|
||||
use crate::{commands::connect::config_option::ConfigOptionCli, interactive_variable};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(version, about, long_about = None)]
|
||||
@@ -18,27 +18,49 @@ pub enum Commands {
|
||||
/// Configures downpour endpoints
|
||||
Connect {
|
||||
#[arg(short, long)]
|
||||
name: String,
|
||||
name: Option<String>,
|
||||
#[command(subcommand)]
|
||||
option: ConfigOptionCli,
|
||||
},
|
||||
/// Uploads new game version to depot
|
||||
Upload(UploadInfo),
|
||||
Upload {
|
||||
#[clap(flatten)]
|
||||
info: UploadInfoCli,
|
||||
#[arg(short, long)]
|
||||
/// Alias of a given connection
|
||||
name: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct UploadInfo {
|
||||
/// Identifies the specific upload style that will be used for the set depot
|
||||
pub upload_style: UploadStyle,
|
||||
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: String,
|
||||
pub game_id: Option<String>,
|
||||
/// Version ID to attach to
|
||||
#[arg(short, long)]
|
||||
pub version_id: String,
|
||||
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)]
|
||||
|
||||
Reference in New Issue
Block a user