Archive packaging menu, auto refresh, trash favorite, test.zip/test.ipa
This commit is contained in:
1 parent
718bf032c8
commit
71e5d72561
11 files changed
+954
-83
No files matched your search
+52
-1
@@ -593,7 +593,9 @@ static BOOL WQRunArchiveCommand(NSArray<NSString *> *words,
|
||||
destination = WQDefaultExtractDestination(archive);
|
||||
|
||||
NSString *message = nil;
|
||||
BOOL ok = WQExtractArchive(archive, destination, &message);
|
||||
BOOL isDeb = [archive.pathExtension.lowercaseString isEqualToString:@"deb"];
|
||||
BOOL ok = isDeb ? WQExtractDebPayload(archive, destination, &message)
|
||||
: WQExtractArchive(archive, destination, &message);
|
||||
WQShellPrintf(context, @"%@\r\n", message ?:
|
||||
(ok ? @"extract: ok" : @"extract: failed"));
|
||||
return YES;
|
||||
@@ -775,6 +777,9 @@ static void WQPrintSBXHelp(WQShellContext *context)
|
||||
" sbx_id <container_path> identify a container\r\n"
|
||||
" mount list mounted filesystems\r\n"
|
||||
" extract <archive> [-C dir] unzip/tar/gz/7z/rar/xz/bz2/zst\r\n"
|
||||
" zip <output.zip> <paths> create a ZIP archive\r\n"
|
||||
" mkdeb <folder> [out.deb] build a Debian package\r\n"
|
||||
" mkipa <folder> [out.ipa] build an IPA from .app/Payload\r\n"
|
||||
" neofetch system information\r\n"
|
||||
" respring restart SpringBoard\r\n"
|
||||
" apt / apt-get update|list|search|show|install|remove\r\n"
|
||||
@@ -850,6 +855,52 @@ static void WQShellLoop(WQShellContext *context)
|
||||
[first isEqualToString:@"dpkg-deb"]) {
|
||||
WQRunPackages(words, context.output, context.error);
|
||||
fflush(context.output);
|
||||
} else if ([first isEqualToString:@"mkdeb"] ||
|
||||
[first isEqualToString:@"mkipa"]) {
|
||||
if (words.count < 2) {
|
||||
WQShellPrintf(context,
|
||||
@"usage: %@ <source-folder> [output]\r\n",
|
||||
first);
|
||||
} else {
|
||||
NSString *source = WQExpandPath(words[1]);
|
||||
NSString *suffix = [first isEqualToString:@"mkdeb"]
|
||||
? @".deb" : @".ipa";
|
||||
NSString *destination = words.count > 2
|
||||
? WQExpandPath(words[2])
|
||||
: [[source stringByDeletingLastPathComponent]
|
||||
stringByAppendingPathComponent:
|
||||
[source.lastPathComponent
|
||||
stringByAppendingString:suffix]];
|
||||
NSString *message = nil;
|
||||
BOOL ok = [first isEqualToString:@"mkdeb"]
|
||||
? WQCreateDebPackage(source, destination,
|
||||
nil, nil, nil, nil, &message)
|
||||
: WQCreateIpaPackage(source, destination,
|
||||
&message);
|
||||
WQShellPrintf(context, @"%@\r\n", message ?:
|
||||
(ok ? @"ok" : @"failed"));
|
||||
}
|
||||
} else if ([first isEqualToString:@"zip"] ||
|
||||
[first isEqualToString:@"compress"]) {
|
||||
if (words.count < 3) {
|
||||
WQShellWrite(context,
|
||||
"usage: zip <output.zip> <file-or-folder>...\r\n");
|
||||
} else {
|
||||
NSString *destination = WQExpandPath(words[1]);
|
||||
NSMutableArray *paths = [NSMutableArray array];
|
||||
for (NSUInteger index = 2; index < words.count; index++)
|
||||
[paths addObject:WQExpandPath(words[index])];
|
||||
char cwdBuffer[PATH_MAX];
|
||||
NSString *base = getcwd(cwdBuffer, sizeof(cwdBuffer))
|
||||
? @(cwdBuffer) : nil;
|
||||
[NSFileManager.defaultManager removeItemAtPath:
|
||||
destination error:nil];
|
||||
NSString *message = nil;
|
||||
BOOL ok = WQCreateZipArchive(paths, destination,
|
||||
base, &message);
|
||||
WQShellPrintf(context, @"%@\r\n", message ?:
|
||||
(ok ? @"zip: ok" : @"zip: failed"));
|
||||
}
|
||||
} else if (WQRunArchiveCommand(words, context)) {
|
||||
// extracted with libarchive
|
||||
} else if (WQRunExternalExecutable(words, context)) {
|
||||
|
||||
Reference in new issue
Block a user