add args for committer name and email
This commit is contained in:
parent
816461e9f4
commit
e12c13a1dd
15
src/main.rs
15
src/main.rs
@ -29,6 +29,11 @@ struct Cli{
|
||||
#[arg(long)]
|
||||
no_template:Option<bool>,
|
||||
|
||||
#[arg(long)]
|
||||
git_committer_name:Option<String>,
|
||||
#[arg(long)]
|
||||
git_committer_email:Option<String>,
|
||||
|
||||
#[arg(long)]
|
||||
asset_id:Option<AssetID>,
|
||||
|
||||
@ -114,6 +119,8 @@ async fn main()->AResult<()>{
|
||||
write_scripts:!cli.no_scripts.unwrap_or(false),
|
||||
}),
|
||||
Commands::DecompileHistoryIntoGit=>decompile_history_into_git(DecompileHistoryConfig{
|
||||
git_committer_name:cli.git_committer_name.unwrap(),
|
||||
git_committer_email:cli.git_committer_email.unwrap(),
|
||||
cookie:cookie.unwrap(),
|
||||
asset_id:cli.asset_id.unwrap(),
|
||||
output_folder:cli.output.unwrap(),
|
||||
@ -669,6 +676,8 @@ fn decompile(config:DecompileConfig)->AResult<()>{
|
||||
}
|
||||
|
||||
struct WriteCommitConfig{
|
||||
git_committer_name:String,
|
||||
git_committer_email:String,
|
||||
output_folder:std::path::PathBuf,
|
||||
write_template:bool,
|
||||
write_models:bool,
|
||||
@ -704,7 +713,7 @@ fn write_commit(config:WriteCommitConfig,b:AResult<(AssetVersion,DecompiledConte
|
||||
|
||||
|
||||
let date=asset_version.created;
|
||||
let sig=git2::Signature::new("roblox-git-history","git_history@strafes.net",&git2::Time::new(date.timestamp(),0)).unwrap();
|
||||
let sig=git2::Signature::new(config.git_committer_name.as_str(),config.git_committer_email.as_str(),&git2::Time::new(date.timestamp(),0)).unwrap();
|
||||
let tree_id={
|
||||
let mut tree_index = repo.index()?;
|
||||
tree_index.add_all([config.output_folder].iter(),git2::IndexAddOption::DEFAULT,None)?;
|
||||
@ -738,6 +747,8 @@ fn write_commit(config:WriteCommitConfig,b:AResult<(AssetVersion,DecompiledConte
|
||||
struct DecompileHistoryConfig{
|
||||
cookie:String,
|
||||
asset_id:AssetID,
|
||||
git_committer_name:String,
|
||||
git_committer_email:String,
|
||||
output_folder:std::path::PathBuf,
|
||||
write_template:bool,
|
||||
write_models:bool,
|
||||
@ -772,6 +783,8 @@ async fn decompile_history_into_git(config:DecompileHistoryConfig)->AResult<()>{
|
||||
.buffered(CONCURRENT_REQUESTS)
|
||||
.for_each(|b:AResult<_>|async{
|
||||
match write_commit(WriteCommitConfig{
|
||||
git_committer_name:config.git_committer_name.clone(),
|
||||
git_committer_email:config.git_committer_email.clone(),
|
||||
output_folder:config.output_folder.clone(),
|
||||
write_template:config.write_template,
|
||||
write_models:config.write_models,
|
||||
|
Loading…
Reference in New Issue
Block a user