rikyoz / bit7z

A C++ static library offering a clean and simple interface to the 7-zip shared libraries.
https://rikyoz.github.io/bit7z
Mozilla Public License 2.0
654 stars 118 forks source link

[Feature Request]: Creation or extraction archive file in one line #188

Open davidds1990 opened 10 months ago

davidds1990 commented 10 months ago

Feature description

Hi Can you provide a static function that takes the same arguments as the 7z CLI App? (Similar to the main function in 7z) This function can be very useful (creation or extraction archive file in one line).

CLI:

7z.exe x archive.7z
7z.exe a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=64m -ms=on -mhe=on -p"Hello world!" archive.7z your_dir

Static function (for example):

int ret = bit7z::cli7z("7z.dll", "x archive.7z");
int ret = bit7z::cli7z("7z.dll", "a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=64m -ms=on -mhe=on -p\"Hello world!\" archive.7z your_dir");

Additional context

No response

Code of Conduct

rikyoz commented 10 months ago

Hi! Unfortunately, the 7-Zip DLLs do not provide a direct way to execute the CLI arguments, so bit7z would need to implement a parser that, given the string of arguments, will execute the corresponding command with the given options. It's not a top priority for the project, as I still need to implement some missing and complex features, but I'll definitely evaluate providing such functionality. Thanks for pointing it out!