mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 22:57:46 +00:00
Update ultimate_extractor.nu
wrote --help
This commit is contained in:
parent
4ce79ac41e
commit
c39d7f1327
1 changed files with 19 additions and 21 deletions
|
@ -1,25 +1,23 @@
|
|||
#As in the file name, the script is designed to conveniently handle any archive format
|
||||
|
||||
#usage: extract archive_name
|
||||
|
||||
def extract [name:string] {
|
||||
#Function to extract archives with different extensions
|
||||
def extract [name:string #name of the archive to extract
|
||||
] {
|
||||
let exten = [ [ex com];
|
||||
['.tar.bz2' 'tar xjf']
|
||||
['.tar.gz' 'tar xzf']
|
||||
['.bz2' 'bunzip2']
|
||||
['.rar' 'unrar x']
|
||||
['.tbz2' 'tar xjf']
|
||||
['.tgz' 'tar xzf']
|
||||
['.zip' 'unzip']
|
||||
['.7z' '/usr/bin/7z x']
|
||||
['.deb' 'ar x']
|
||||
['.tar.xz' 'tar xvf']
|
||||
['.tar.zst' 'tar xvf']
|
||||
['.tar' 'tar xvf']
|
||||
['.gz' 'gunzip']
|
||||
['.Z' 'uncompress']
|
||||
]
|
||||
|
||||
['.tar.bz2' 'tar xjf']
|
||||
['.tar.gz' 'tar xzf']
|
||||
['.bz2' 'bunzip2']
|
||||
['.rar' 'unrar x']
|
||||
['.tbz2' 'tar xjf']
|
||||
['.tgz' 'tar xzf']
|
||||
['.zip' 'unzip']
|
||||
['.7z' '/usr/bin/7z x']
|
||||
['.deb' 'ar x']
|
||||
['.tar.xz' 'tar xvf']
|
||||
['.tar.zst' 'tar xvf']
|
||||
['.tar' 'tar xvf']
|
||||
['.gz' 'gunzip']
|
||||
['.Z' 'uncompress']
|
||||
]
|
||||
|
||||
let command = ($exten|where $name =~ $it.ex|first)
|
||||
if ($command|empty?) {
|
||||
echo 'Error! Unsupported file extension'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue