Functions
This commit is contained in:
parent
bdb154dac4
commit
36e1532912
@ -1,5 +1,2 @@
|
|||||||
# Key bindings
|
# Key bindings
|
||||||
|
|
||||||
function fish_user_key_bindings
|
|
||||||
fzf --fish | source
|
|
||||||
end
|
|
||||||
3
functions/ddc.fish
Normal file
3
functions/ddc.fish
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
function ddc --description "dd with progress"
|
||||||
|
command dd status=progress $argv
|
||||||
|
end
|
||||||
55
functions/extract.fish
Normal file
55
functions/extract.fish
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
function extract --description "Extract common archive formats"
|
||||||
|
if test (count $argv) -ne 1
|
||||||
|
echo "Usage: extract <archive>"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
set -l file $argv[1]
|
||||||
|
|
||||||
|
if not test -f "$file"
|
||||||
|
echo "File not found: $file"
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
switch "$file"
|
||||||
|
case "*.tar.bz2" "*.tbz2"
|
||||||
|
tar -xjf "$file"
|
||||||
|
|
||||||
|
case "*.tar.gz" "*.tgz"
|
||||||
|
tar -xzf "$file"
|
||||||
|
|
||||||
|
case "*.tar.xz" "*.txz"
|
||||||
|
tar -xJf "$file"
|
||||||
|
|
||||||
|
case "*.tar.zst"
|
||||||
|
tar --zstd -xf "$file"
|
||||||
|
|
||||||
|
case "*.tar"
|
||||||
|
tar -xf "$file"
|
||||||
|
|
||||||
|
case "*.zip"
|
||||||
|
unzip "$file"
|
||||||
|
|
||||||
|
case "*.7z"
|
||||||
|
7z x "$file"
|
||||||
|
|
||||||
|
case "*.rar"
|
||||||
|
unrar x "$file"
|
||||||
|
|
||||||
|
case "*.gz"
|
||||||
|
gunzip "$file"
|
||||||
|
|
||||||
|
case "*.bz2"
|
||||||
|
bunzip2 "$file"
|
||||||
|
|
||||||
|
case "*.xz"
|
||||||
|
unxz "$file"
|
||||||
|
|
||||||
|
case "*.zst"
|
||||||
|
unzstd "$file"
|
||||||
|
|
||||||
|
case '*'
|
||||||
|
echo "Unsupported archive format."
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
5
functions/fish_user_key_bindings.fish
Normal file
5
functions/fish_user_key_bindings.fish
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Key bindings
|
||||||
|
|
||||||
|
function fish_user_key_bindings
|
||||||
|
fzf --fish | source
|
||||||
|
end
|
||||||
3
functions/indent_python.fish
Normal file
3
functions/indent_python.fish
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
function indent_python --description "Fix Python indentation"
|
||||||
|
python3 /opt/misc_scripts/fix_indent.py $argv
|
||||||
|
end
|
||||||
4
functions/mkcd.fish
Normal file
4
functions/mkcd.fish
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
function mkcd --description "Create a directory and enter it"
|
||||||
|
mkdir -p $argv
|
||||||
|
and cd $argv[-1]
|
||||||
|
end
|
||||||
32
functions/updt.fish
Normal file
32
functions/updt.fish
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
function updt --description "Update the system and common package managers"
|
||||||
|
sudo apt update
|
||||||
|
or return
|
||||||
|
|
||||||
|
sudo apt full-upgrade -y
|
||||||
|
or return
|
||||||
|
|
||||||
|
sudo apt autoremove -y
|
||||||
|
or return
|
||||||
|
|
||||||
|
sudo apt clean
|
||||||
|
|
||||||
|
if command -q flatpak
|
||||||
|
flatpak update -y
|
||||||
|
end
|
||||||
|
|
||||||
|
if command -q snap
|
||||||
|
sudo snap refresh
|
||||||
|
end
|
||||||
|
|
||||||
|
if command -q rustup
|
||||||
|
rustup update
|
||||||
|
end
|
||||||
|
|
||||||
|
if command -q cargo-install-update
|
||||||
|
cargo install-update -a
|
||||||
|
end
|
||||||
|
|
||||||
|
if command -q pipx
|
||||||
|
pipx upgrade-all
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user