1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 06:37:46 +00:00

Allow ultimate_extractor to unzip exe files (#1075)

The unzip command can unzip exe files, this reflects that in
`ultimate_extractor.nu`
This commit is contained in:
ViSaturn 2025-03-22 16:29:57 +03:00 committed by GitHub
parent 095fa411c7
commit 13de3375c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,20 +1,20 @@
# Function to extract archives with different extensions. # Function to extract archives with different extensions.
export def extract [name:string] { export def extract [name:string] {
let handlers = [ [extension command]; let handlers = [ [extension command];
['tar\.bz2|tbz|tbz2' 'tar xvjf'] ['tar\.bz2|tbz|tbz2' 'tar xvjf']
['tar\.gz|tgz' 'tar xvzf'] ['tar\.gz|tgz' 'tar xvzf']
['tar\.xz|txz' 'tar xvf'] ['tar\.xz|txz' 'tar xvf']
['tar\.Z' 'tar xvZf'] ['tar\.Z' 'tar xvZf']
['bz2' 'bunzip2'] ['bz2' 'bunzip2']
['deb' 'ar x'] ['deb' 'ar x']
['gz' 'gunzip'] ['gz' 'gunzip']
['pkg' 'pkgutil --expand'] ['pkg' 'pkgutil --expand']
['rar' 'unrar x'] ['rar' 'unrar x']
['tar' 'tar xvf'] ['tar' 'tar xvf']
['xz' 'xz --decompress'] ['xz' 'xz --decompress']
['zip|war|jar|nupkg' 'unzip'] ['zip|war|jar|nupkg|exe' 'unzip']
['Z' 'uncompress'] ['Z' 'uncompress']
['7z' '7za x'] ['7z' '7za x']
] ]
let maybe_handler = ($handlers | where $name =~ $'\.(($it.extension))$') let maybe_handler = ($handlers | where $name =~ $'\.(($it.extension))$')
if ($maybe_handler | is-empty) { if ($maybe_handler | is-empty) {