Mark security cookie as optional

This commit is contained in:
Lucien Greathouse
2019-08-28 12:09:12 -07:00
parent 056fc5e087
commit ea112dd93d
2 changed files with 4 additions and 4 deletions

View File

@@ -54,7 +54,7 @@ fn main() {
(about: "Generates a place or model file out of the project and uploads it to Roblox.") (about: "Generates a place or model file out of the project and uploads it to Roblox.")
(@arg PROJECT: "Path to the project to upload. Defaults to the current directory.") (@arg PROJECT: "Path to the project to upload. Defaults to the current directory.")
(@arg kind: --kind +takes_value "The kind of asset to generate, 'place', or 'model'. Defaults to place.") (@arg kind: --kind +takes_value "The kind of asset to generate, 'place', or 'model'. Defaults to place.")
(@arg cookie: --cookie +takes_value +required "Security cookie to authenticate with.") (@arg cookie: --cookie +takes_value "Security cookie to authenticate with. If not specified, Rojo will attempt to find one from the system automatically.")
(@arg asset_id: --asset_id +takes_value +required "Asset ID to upload to.") (@arg asset_id: --asset_id +takes_value +required "Asset ID to upload to.")
) )
); );
@@ -172,7 +172,7 @@ fn start_upload(sub_matches: &ArgMatches) {
}; };
let kind = sub_matches.value_of("kind"); let kind = sub_matches.value_of("kind");
let security_cookie = sub_matches.value_of("cookie").unwrap(); let security_cookie = sub_matches.value_of("cookie").map(Into::into);
let asset_id: u64 = { let asset_id: u64 = {
let arg = sub_matches.value_of("asset_id").unwrap(); let arg = sub_matches.value_of("asset_id").unwrap();
@@ -188,7 +188,7 @@ fn start_upload(sub_matches: &ArgMatches) {
let options = commands::UploadOptions { let options = commands::UploadOptions {
fuzzy_project_path, fuzzy_project_path,
security_cookie: security_cookie.to_string(), security_cookie: security_cookie,
asset_id, asset_id,
kind, kind,
}; };

View File

@@ -11,7 +11,7 @@ pub enum UploadError {
#[derive(Debug)] #[derive(Debug)]
pub struct UploadOptions<'a> { pub struct UploadOptions<'a> {
pub fuzzy_project_path: PathBuf, pub fuzzy_project_path: PathBuf,
pub security_cookie: String, pub security_cookie: Option<String>,
pub asset_id: u64, pub asset_id: u64,
pub kind: Option<&'a str>, pub kind: Option<&'a str>,
} }