mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 15:17:47 +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,24 +1,22 @@
|
||||||
#As in the file name, the script is designed to conveniently handle any archive format
|
#Function to extract archives with different extensions
|
||||||
|
def extract [name:string #name of the archive to extract
|
||||||
#usage: extract archive_name
|
] {
|
||||||
|
|
||||||
def extract [name:string] {
|
|
||||||
let exten = [ [ex com];
|
let exten = [ [ex com];
|
||||||
['.tar.bz2' 'tar xjf']
|
['.tar.bz2' 'tar xjf']
|
||||||
['.tar.gz' 'tar xzf']
|
['.tar.gz' 'tar xzf']
|
||||||
['.bz2' 'bunzip2']
|
['.bz2' 'bunzip2']
|
||||||
['.rar' 'unrar x']
|
['.rar' 'unrar x']
|
||||||
['.tbz2' 'tar xjf']
|
['.tbz2' 'tar xjf']
|
||||||
['.tgz' 'tar xzf']
|
['.tgz' 'tar xzf']
|
||||||
['.zip' 'unzip']
|
['.zip' 'unzip']
|
||||||
['.7z' '/usr/bin/7z x']
|
['.7z' '/usr/bin/7z x']
|
||||||
['.deb' 'ar x']
|
['.deb' 'ar x']
|
||||||
['.tar.xz' 'tar xvf']
|
['.tar.xz' 'tar xvf']
|
||||||
['.tar.zst' 'tar xvf']
|
['.tar.zst' 'tar xvf']
|
||||||
['.tar' 'tar xvf']
|
['.tar' 'tar xvf']
|
||||||
['.gz' 'gunzip']
|
['.gz' 'gunzip']
|
||||||
['.Z' 'uncompress']
|
['.Z' 'uncompress']
|
||||||
]
|
]
|
||||||
|
|
||||||
let command = ($exten|where $name =~ $it.ex|first)
|
let command = ($exten|where $name =~ $it.ex|first)
|
||||||
if ($command|empty?) {
|
if ($command|empty?) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue