forked from StrafesNET/map-tool
vpk contents + shorten arg
This commit is contained in:
parent
8b7f034f50
commit
9e30f5dca7
14
src/main.rs
14
src/main.rs
@ -7,7 +7,7 @@ use anyhow::Result as AResult;
|
||||
#[command(propagate_version = true)]
|
||||
struct Cli {
|
||||
#[arg(long)]
|
||||
vpk_path:Option<std::path::PathBuf>,
|
||||
vpk:Option<std::path::PathBuf>,
|
||||
#[command(subcommand)]
|
||||
command: Commands,
|
||||
}
|
||||
@ -18,6 +18,7 @@ enum Commands {
|
||||
DownloadTextures(PathBufList),
|
||||
ExtractTextures(PathBufList),
|
||||
ConvertTextures,
|
||||
VPKContents,
|
||||
DownloadMeshes(PathBufList),
|
||||
Extract(PathBufList),
|
||||
WriteAttributes,
|
||||
@ -43,7 +44,8 @@ fn main() -> AResult<()> {
|
||||
match cli.command {
|
||||
Commands::Download(map_list)=>download(map_list.maps),
|
||||
Commands::DownloadTextures(pathlist)=>download_textures(pathlist.paths),
|
||||
Commands::ExtractTextures(pathlist)=>extract_textures(pathlist.paths,cli.vpk_path.unwrap()),
|
||||
Commands::ExtractTextures(pathlist)=>extract_textures(pathlist.paths,cli.vpk.unwrap()),
|
||||
Commands::VPKContents=>vpk_contents(cli.vpk.unwrap()),
|
||||
Commands::ConvertTextures=>convert_textures(),
|
||||
Commands::DownloadMeshes(pathlist)=>download_meshes(pathlist.paths),
|
||||
Commands::Extract(pathlist)=>extract(pathlist.paths),
|
||||
@ -1095,4 +1097,12 @@ fn extract_textures(paths:Vec<std::path::PathBuf>,vpk_path:std::path::PathBuf)->
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn vpk_contents(vpk_path:std::path::PathBuf)->AResult<()>{
|
||||
let vpk_index=vpk::VPK::read(&vpk_path)?;
|
||||
for (label,entry) in vpk_index.tree.into_iter(){
|
||||
println!("vpk label={} entry={:?}",label,entry);
|
||||
}
|
||||
Ok(())
|
||||
}
|
Loading…
Reference in New Issue
Block a user