move type conversion to argument stuff
This commit is contained in:
parent
5085f6587f
commit
b89a787af2
36
src/main.rs
36
src/main.rs
@ -261,7 +261,7 @@ async fn main()->AResult<()>{
|
|||||||
cookie:Cookie::from_type(subcommand.cookie_type,subcommand.cookie).await?.0,
|
cookie:Cookie::from_type(subcommand.cookie_type,subcommand.cookie).await?.0,
|
||||||
asset_id:subcommand.asset_id,
|
asset_id:subcommand.asset_id,
|
||||||
output_folder:subcommand.output_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
output_folder:subcommand.output_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
||||||
style:subcommand.style,
|
style:subcommand.style.rox(),
|
||||||
write_template:subcommand.write_template.unwrap_or(false),
|
write_template:subcommand.write_template.unwrap_or(false),
|
||||||
write_models:subcommand.write_models.unwrap_or(false),
|
write_models:subcommand.write_models.unwrap_or(false),
|
||||||
write_scripts:subcommand.write_scripts.unwrap_or(true),
|
write_scripts:subcommand.write_scripts.unwrap_or(true),
|
||||||
@ -290,18 +290,18 @@ async fn main()->AResult<()>{
|
|||||||
input_folder:subcommand.input_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
input_folder:subcommand.input_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
||||||
output_file:subcommand.output_file,
|
output_file:subcommand.output_file,
|
||||||
template:subcommand.template,
|
template:subcommand.template,
|
||||||
style:subcommand.style,
|
style:subcommand.style.map(|s|s.rox()),
|
||||||
}).await,
|
}).await,
|
||||||
Commands::CompileUpload(subcommand)=>compile_upload(CompileUploadConfig{
|
Commands::CompileUpload(subcommand)=>compile_upload(CompileUploadConfig{
|
||||||
input_folder:subcommand.input_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
input_folder:subcommand.input_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
||||||
template:subcommand.template,
|
template:subcommand.template,
|
||||||
style:subcommand.style,
|
style:subcommand.style.map(|s|s.rox()),
|
||||||
cookie:Cookie::from_type(subcommand.cookie_type,subcommand.cookie).await?.0,
|
cookie:Cookie::from_type(subcommand.cookie_type,subcommand.cookie).await?.0,
|
||||||
group:subcommand.group,
|
group:subcommand.group,
|
||||||
asset_id:subcommand.asset_id,
|
asset_id:subcommand.asset_id,
|
||||||
}).await,
|
}).await,
|
||||||
Commands::Decompile(subcommand)=>decompile(DecompileConfig{
|
Commands::Decompile(subcommand)=>decompile(DecompileConfig{
|
||||||
style:subcommand.style,
|
style:subcommand.style.rox(),
|
||||||
input_file:subcommand.input_file,
|
input_file:subcommand.input_file,
|
||||||
output_folder:subcommand.output_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
output_folder:subcommand.output_folder.unwrap_or_else(||std::env::current_dir().unwrap()),
|
||||||
write_template:subcommand.write_template.unwrap_or(false),
|
write_template:subcommand.write_template.unwrap_or(false),
|
||||||
@ -313,7 +313,7 @@ async fn main()->AResult<()>{
|
|||||||
git_committer_email:subcommand.git_committer_email,
|
git_committer_email:subcommand.git_committer_email,
|
||||||
input_folder:subcommand.input_folder,
|
input_folder:subcommand.input_folder,
|
||||||
output_folder:std::env::current_dir()?,
|
output_folder:std::env::current_dir()?,
|
||||||
style:subcommand.style,
|
style:subcommand.style.rox(),
|
||||||
write_template:subcommand.write_template.unwrap_or(false),
|
write_template:subcommand.write_template.unwrap_or(false),
|
||||||
write_models:subcommand.write_models.unwrap_or(false),
|
write_models:subcommand.write_models.unwrap_or(false),
|
||||||
write_scripts:subcommand.write_scripts.unwrap_or(true),
|
write_scripts:subcommand.write_scripts.unwrap_or(true),
|
||||||
@ -324,7 +324,7 @@ async fn main()->AResult<()>{
|
|||||||
cookie:Cookie::from_type(subcommand.cookie_type,subcommand.cookie).await?.0,
|
cookie:Cookie::from_type(subcommand.cookie_type,subcommand.cookie).await?.0,
|
||||||
asset_id:subcommand.asset_id,
|
asset_id:subcommand.asset_id,
|
||||||
output_folder:std::env::current_dir()?,
|
output_folder:std::env::current_dir()?,
|
||||||
style:subcommand.style,
|
style:subcommand.style.rox(),
|
||||||
write_template:subcommand.write_template.unwrap_or(false),
|
write_template:subcommand.write_template.unwrap_or(false),
|
||||||
write_models:subcommand.write_models.unwrap_or(false),
|
write_models:subcommand.write_models.unwrap_or(false),
|
||||||
write_scripts:subcommand.write_scripts.unwrap_or(true),
|
write_scripts:subcommand.write_scripts.unwrap_or(true),
|
||||||
@ -605,7 +605,7 @@ fn load_dom<R:Read>(input:R)->AResult<rbx_dom_weak::WeakDom>{
|
|||||||
|
|
||||||
|
|
||||||
struct DecompileConfig{
|
struct DecompileConfig{
|
||||||
style:Style,
|
style:rox_compiler::Style,
|
||||||
input_file:PathBuf,
|
input_file:PathBuf,
|
||||||
output_folder:PathBuf,
|
output_folder:PathBuf,
|
||||||
write_template:bool,
|
write_template:bool,
|
||||||
@ -627,7 +627,7 @@ async fn decompile(config:DecompileConfig)->AResult<()>{
|
|||||||
//generate folders, models, and scripts
|
//generate folders, models, and scripts
|
||||||
//delete models and scripts from dom
|
//delete models and scripts from dom
|
||||||
context.write_files(rox_compiler::WriteConfig{
|
context.write_files(rox_compiler::WriteConfig{
|
||||||
style:config.style.rox(),
|
style:config.style,
|
||||||
output_folder:config.output_folder,
|
output_folder:config.output_folder,
|
||||||
write_template:config.write_template,
|
write_template:config.write_template,
|
||||||
write_models:config.write_models,
|
write_models:config.write_models,
|
||||||
@ -640,7 +640,7 @@ async fn decompile(config:DecompileConfig)->AResult<()>{
|
|||||||
struct DownloadDecompileConfig{
|
struct DownloadDecompileConfig{
|
||||||
cookie:String,
|
cookie:String,
|
||||||
asset_id:AssetID,
|
asset_id:AssetID,
|
||||||
style:Style,
|
style:rox_compiler::Style,
|
||||||
output_folder:PathBuf,
|
output_folder:PathBuf,
|
||||||
write_template:bool,
|
write_template:bool,
|
||||||
write_models:bool,
|
write_models:bool,
|
||||||
@ -655,7 +655,7 @@ async fn download_decompile(config:DownloadDecompileConfig)->AResult<()>{
|
|||||||
let context=rox_compiler::DecompiledContext::from_dom(dom);
|
let context=rox_compiler::DecompiledContext::from_dom(dom);
|
||||||
|
|
||||||
context.write_files(rox_compiler::WriteConfig{
|
context.write_files(rox_compiler::WriteConfig{
|
||||||
style:config.style.rox(),
|
style:config.style,
|
||||||
output_folder:config.output_folder,
|
output_folder:config.output_folder,
|
||||||
write_template:config.write_template,
|
write_template:config.write_template,
|
||||||
write_models:config.write_models,
|
write_models:config.write_models,
|
||||||
@ -669,7 +669,7 @@ struct WriteCommitConfig{
|
|||||||
git_committer_name:String,
|
git_committer_name:String,
|
||||||
git_committer_email:String,
|
git_committer_email:String,
|
||||||
output_folder:PathBuf,
|
output_folder:PathBuf,
|
||||||
style:Style,
|
style:rox_compiler::Style,
|
||||||
write_template:bool,
|
write_template:bool,
|
||||||
write_models:bool,
|
write_models:bool,
|
||||||
write_scripts:bool,
|
write_scripts:bool,
|
||||||
@ -699,7 +699,7 @@ async fn write_commit(config:WriteCommitConfig,b:Result<AResult<(AssetVersion,ro
|
|||||||
|
|
||||||
//write files
|
//write files
|
||||||
context.write_files(rox_compiler::WriteConfig{
|
context.write_files(rox_compiler::WriteConfig{
|
||||||
style:config.style.rox(),
|
style:config.style,
|
||||||
output_folder:config.output_folder.clone(),
|
output_folder:config.output_folder.clone(),
|
||||||
write_template:config.write_template,
|
write_template:config.write_template,
|
||||||
write_models:config.write_models,
|
write_models:config.write_models,
|
||||||
@ -760,7 +760,7 @@ struct DecompileHistoryConfig{
|
|||||||
git_committer_name:String,
|
git_committer_name:String,
|
||||||
git_committer_email:String,
|
git_committer_email:String,
|
||||||
input_folder:PathBuf,
|
input_folder:PathBuf,
|
||||||
style:Style,
|
style:rox_compiler::Style,
|
||||||
output_folder:PathBuf,
|
output_folder:PathBuf,
|
||||||
write_template:bool,
|
write_template:bool,
|
||||||
write_models:bool,
|
write_models:bool,
|
||||||
@ -810,7 +810,7 @@ struct DownloadAndDecompileHistoryConfig{
|
|||||||
asset_id:AssetID,
|
asset_id:AssetID,
|
||||||
git_committer_name:String,
|
git_committer_name:String,
|
||||||
git_committer_email:String,
|
git_committer_email:String,
|
||||||
style:Style,
|
style:rox_compiler::Style,
|
||||||
output_folder:PathBuf,
|
output_folder:PathBuf,
|
||||||
write_template:bool,
|
write_template:bool,
|
||||||
write_models:bool,
|
write_models:bool,
|
||||||
@ -858,7 +858,7 @@ struct CompileConfig{
|
|||||||
input_folder:PathBuf,
|
input_folder:PathBuf,
|
||||||
output_file:PathBuf,
|
output_file:PathBuf,
|
||||||
template:Option<PathBuf>,
|
template:Option<PathBuf>,
|
||||||
style:Option<Style>,
|
style:Option<rox_compiler::Style>,
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn compile(config:CompileConfig)->AResult<()>{
|
async fn compile(config:CompileConfig)->AResult<()>{
|
||||||
@ -872,7 +872,7 @@ async fn compile(config:CompileConfig)->AResult<()>{
|
|||||||
|
|
||||||
rox_compiler::compile(rox_compiler::CompileConfig{
|
rox_compiler::compile(rox_compiler::CompileConfig{
|
||||||
input_folder:config.input_folder,
|
input_folder:config.input_folder,
|
||||||
style:config.style.map(|s|s.rox()),
|
style:config.style,
|
||||||
},&mut dom).await?;
|
},&mut dom).await?;
|
||||||
|
|
||||||
let mut output_place=config.output_file.clone();
|
let mut output_place=config.output_file.clone();
|
||||||
@ -888,7 +888,7 @@ async fn compile(config:CompileConfig)->AResult<()>{
|
|||||||
struct CompileUploadConfig{
|
struct CompileUploadConfig{
|
||||||
input_folder:PathBuf,
|
input_folder:PathBuf,
|
||||||
template:Option<PathBuf>,
|
template:Option<PathBuf>,
|
||||||
style:Option<Style>,
|
style:Option<rox_compiler::Style>,
|
||||||
cookie:String,
|
cookie:String,
|
||||||
group:Option<u64>,
|
group:Option<u64>,
|
||||||
asset_id:AssetID,
|
asset_id:AssetID,
|
||||||
@ -902,7 +902,7 @@ async fn compile_upload(config:CompileUploadConfig)->AResult<()>{
|
|||||||
|
|
||||||
rox_compiler::compile(rox_compiler::CompileConfig{
|
rox_compiler::compile(rox_compiler::CompileConfig{
|
||||||
input_folder:config.input_folder,
|
input_folder:config.input_folder,
|
||||||
style:config.style.map(|s|s.rox()),
|
style:config.style,
|
||||||
},&mut dom).await?;
|
},&mut dom).await?;
|
||||||
|
|
||||||
//make a binary file in a buffer in memory
|
//make a binary file in a buffer in memory
|
||||||
|
Loading…
Reference in New Issue
Block a user