Add extract function for fish
This commit is contained in:
parent
17363ff709
commit
2c7474a7d4
23
fish/.config/fish/functions/extract.fish
Normal file
23
fish/.config/fish/functions/extract.fish
Normal file
@ -0,0 +1,23 @@
|
||||
function extract --description "Expand or extract bundled & compressed files"
|
||||
set --local ext (echo $argv[1] | awk -F. '{print $NF}')
|
||||
switch $ext
|
||||
case tar # non-compressed, just bundled
|
||||
tar -xvf $argv[1]
|
||||
case gz
|
||||
if test (echo $argv[1] | awk -F. '{print $(NF-1)}') = tar # tar bundle compressed with gzip
|
||||
tar -zxvf $argv[1]
|
||||
else # single gzip
|
||||
gunzip $argv[1]
|
||||
end
|
||||
case tgz # same as tar.gz
|
||||
tar -zxvf $argv[1]
|
||||
case bz2 # tar compressed with bzip2
|
||||
tar -jxvf $argv[1]
|
||||
case rar
|
||||
unrar x $argv[1]
|
||||
case zip
|
||||
unzip $argv[1]
|
||||
case '*'
|
||||
echo "unknown extension"
|
||||
end
|
||||
end
|
@ -13,6 +13,9 @@ set zap
|
||||
|
||||
set smarthome
|
||||
|
||||
set brackets ""')>]}"
|
||||
set matchbrackets "(<[{)>]}"
|
||||
|
||||
# editor
|
||||
|
||||
set minibar
|
||||
@ -25,7 +28,7 @@ set stateflags
|
||||
set mouse
|
||||
|
||||
set backup
|
||||
set historylog
|
||||
#set historylog
|
||||
|
||||
set multibuffer
|
||||
|
||||
@ -42,3 +45,5 @@ set keycolor slate
|
||||
set functioncolor lightblack
|
||||
set minicolor bold,white,slate
|
||||
set promptcolor bold,white,slate
|
||||
|
||||
include "/usr/share/nano/*.nanorc"
|
Loading…
x
Reference in New Issue
Block a user