✨ feat(fish): missing_package function to use when calling an app thats not installed in the system
This commit is contained in:
parent
051f203efd
commit
3d43a97ac4
44 changed files with 205 additions and 57 deletions
|
@ -1,3 +1,7 @@
|
|||
function cat --wraps=bat --description 'alias cat=bat'
|
||||
if type -f bat &>/dev/null
|
||||
bat $argv
|
||||
else
|
||||
cat $argv
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function catp --wraps='bat --paging=always' --description 'alias catp=bat --paging=always'
|
||||
if type -f bat &>/dev/null
|
||||
bat --paging=always $argv
|
||||
else
|
||||
cat --paging=always $argv
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function codeinfo --wraps='scc ./' --description 'alias codeinfo=scc ./'
|
||||
if type -f scc &>/dev/null
|
||||
scc ./ $argv
|
||||
else
|
||||
missing_package scc
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function disks --wraps=duf --description 'alias disks=duf'
|
||||
if type -f duf &>/dev/null
|
||||
duf $argv
|
||||
else
|
||||
missing_package duf
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
function dots --description 'alias dots=yadm enter lazygit'
|
||||
cd $HOME
|
||||
yadm enter lazygit $argv
|
||||
fish -c 'cd $HOME; yadm enter lazygit'
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function dsize --wraps='dua i' --description 'alias dsize=dua i'
|
||||
if type -f dua &>/dev/null
|
||||
dua i $argv
|
||||
else
|
||||
missing_package dua-cli
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
function ea --wraps='nvim ~/.config/fish/aliases.fish' --description 'alias ea=nvim ~/.config/fish/aliases.fish'
|
||||
nvim ~/.config/fish/aliases.fish $argv
|
||||
end
|
|
@ -1,3 +0,0 @@
|
|||
function ef --wraps='nvim ~/.config/fish/config.fish' --description 'alias ef=nvim ~/.config/fish/config.fish'
|
||||
nvim ~/.config/fish/config.fish $argv
|
||||
end
|
|
@ -1,3 +0,0 @@
|
|||
function eg --wraps='nvim ~/.gitconfig' --description 'alias eg=nvim ~/.gitconfig'
|
||||
nvim ~/.gitconfig $argv
|
||||
end
|
|
@ -1,3 +0,0 @@
|
|||
function ev --wraps='nvim ~/.config/fish/variables.fish' --description 'alias ev=nvim ~/.config/fish/variables.fish'
|
||||
nvim ~/.config/fish/variables.fish $argv
|
||||
end
|
|
@ -1,3 +1,7 @@
|
|||
function f --wraps=fzf --description 'alias f=fzf'
|
||||
if type -f fzf &>/dev/null
|
||||
fzf $argv
|
||||
else
|
||||
missing_package fzf
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
function fe
|
||||
if type -f yazi &>/dev/null
|
||||
set tmp (mktemp -t "yazi-cwd.XXXXX")
|
||||
yazi --cwd-file="$tmp"
|
||||
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
|
||||
cd -- "$cwd"
|
||||
end
|
||||
rm -f -- "$tmp"
|
||||
else
|
||||
missing_package yazi
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function fetch --wraps=fastfetch --description 'alias fetch=fastfetch'
|
||||
if type -f fastfetch &>/dev/null
|
||||
fastfetch $argv
|
||||
else
|
||||
missing_package fastfetch
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function gfetch --wraps=onefetch --description 'alias gfetch=onefetch'
|
||||
if type -f onefetch &>/dev/null
|
||||
onefetch $argv
|
||||
else
|
||||
missing_package onefetch
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function gpt --wraps='tgpt -i' --description 'alias gpt=tgpt -i'
|
||||
if type -f tgpt &>/dev/null
|
||||
tgpt $argv
|
||||
else
|
||||
missing_package tgpt
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function info --wraps=tldr --description 'alias info=tldr'
|
||||
if type -f tldr &>/dev/null
|
||||
tldr $argv
|
||||
else
|
||||
missing_package tldr
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function l --wraps='eza --long --header -a --icons --git --group-directories-first' --description 'alias l=eza --long --header -a --icons --git --group-directories-first'
|
||||
if type -f eza &>/dev/null
|
||||
eza --long --header -a --icons --git --group-directories-first --hyperlink $argv
|
||||
else
|
||||
missing_package eza
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function ld --wraps=lazydocker --description 'alias ld=lazydocker'
|
||||
if type -f lazydocker &>/dev/null
|
||||
lazydocker $argv
|
||||
else
|
||||
missing_package lazydocker
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function ldh --wraps='eza --long --header --icons -D --git' --description 'alias ldh=eza --long --header --icons -D --git'
|
||||
if type -f eza &>/dev/null
|
||||
eza --long --header --icons -D --git --hyperlink $argv
|
||||
else
|
||||
missing_package eza
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function lg --wraps=lazygit --description 'alias lg=lazygit'
|
||||
if type -f eza &>/dev/null
|
||||
lazygit $argv
|
||||
else
|
||||
missing_package lazygit
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function lh --wraps='eza --long --header --icons --git --group-directories-first' --description 'alias lh=eza --long --header --icons --git --group-directories-first'
|
||||
if type -f eza &>/dev/null
|
||||
eza --long --header --icons --git --group-directories-first --hyperlink $argv
|
||||
else
|
||||
missing_package eza
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function ls --wraps='eza -a --icons --group-directories-first' --description 'alias ls=eza -a --icons --group-directories-first'
|
||||
if type -f eza &>/dev/null
|
||||
eza -a --icons --group-directories-first --hyperlink $argv
|
||||
else
|
||||
missing_package eza
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function lsh --wraps='eza --icons --git --group-directories-first' --description 'alias lsh=eza --icons --git --group-directories-first'
|
||||
if type -f eza &>/dev/null
|
||||
eza --icons --git --group-directories-first --hyperlink $argv
|
||||
else
|
||||
missing_package eza
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function lt --wraps='eza --long --header -a --icons --tree --git --group-directories-first' --description 'alias lt=eza --long --header -a --icons --tree --git --group-directories-first'
|
||||
if type -f eza &>/dev/null
|
||||
eza --long --header -a --icons --tree --git --group-directories-first --hyperlink $argv
|
||||
else
|
||||
missing_package eza
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function lth --wraps='eza --long --header --icons --tree --git --group-directories-first' --description 'alias lth=eza --long --header --icons --tree --git --group-directories-first'
|
||||
if type -f eza &>/dev/null
|
||||
eza --long --header --icons --tree --git --group-directories-first --hyperlink $argv
|
||||
else
|
||||
missing_package eza
|
||||
end
|
||||
end
|
||||
|
|
12
.config/fish/functions/missing_package.fish
Normal file
12
.config/fish/functions/missing_package.fish
Normal file
|
@ -0,0 +1,12 @@
|
|||
function missing_package
|
||||
while true
|
||||
read -l -P "$argv[1] not found. Do you want to install it? [y/N] " confirm
|
||||
|
||||
if test "$confirm" = y
|
||||
i $argv
|
||||
break
|
||||
else
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,3 +1,7 @@
|
|||
function ni --wraps='npm install' --description 'alias ni=npm install'
|
||||
if type -f npm &>/dev/null
|
||||
npm install $argv
|
||||
else
|
||||
missing_package npm
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function nid --wraps='npm install --save-dev' --description 'alias nid=npm install --save-dev'
|
||||
if type -f npm &>/dev/null
|
||||
npm install --save-dev $argv
|
||||
else
|
||||
missing_package npm
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function nis --wraps='npm install --save' --description 'alias nis=npm install --save'
|
||||
if type -f npm &>/dev/null
|
||||
npm install --save $argv
|
||||
else
|
||||
missing_package npm
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function nls --wraps='npm list' --description 'alias nls=npm list'
|
||||
if type -f npm &>/dev/null
|
||||
npm list $argv
|
||||
else
|
||||
missing_package npm
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function nlsg --wraps='npm list --global' --description 'alias nlsg=npm list --global'
|
||||
if type -f npm &>/dev/null
|
||||
npm list --global $argv
|
||||
else
|
||||
missing_package npm
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function nu --wraps='npm uninstall' --description 'alias nu=npm uninstall'
|
||||
if type -f npm &>/dev/null
|
||||
npm uninstall $argv
|
||||
else
|
||||
missing_package npm
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function nud --wraps='npm uninstall --save-dev' --description 'alias nud=npm uninstall --save-dev'
|
||||
if type -f npm &>/dev/null
|
||||
npm uninstall --save-dev $argv
|
||||
else
|
||||
missing_package npm
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function nup --wraps='npm update' --description 'alias nup=npm update'
|
||||
if type -f npm &>/dev/null
|
||||
npm update $argv
|
||||
else
|
||||
missing_package npm
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function nus --wraps='npm uninstall --save' --description 'alias nus=npm uninstall --save'
|
||||
if type -f npm &>/dev/null
|
||||
npm uninstall --save $argv
|
||||
else
|
||||
missing_package npm
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function pages --wraps=navi --description 'alias pages=navi'
|
||||
if type -f navi &>/dev/null
|
||||
navi $argv
|
||||
else
|
||||
missing_package navi
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function proc --wraps=sysz --description 'alias proc=sysz'
|
||||
if type -f sysz &>/dev/null
|
||||
sysz $argv
|
||||
else
|
||||
missing_package sysz
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
function pse --wraps=pacseek --description 'alias pse=pacseek'
|
||||
if type -f pacseek &>/dev/null
|
||||
pacseek $argv
|
||||
else
|
||||
missing_package pacseek
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
function r --wraps='mise run' --description 'alias r=mise run'
|
||||
if type -f mise &>/dev/null
|
||||
mise run $argv
|
||||
else
|
||||
missing_package mise
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
function s --wraps=sudo --description 'alias s=sudo'
|
||||
sudo $argv
|
||||
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function t --wraps=tmux --description 'alias t=tmux'
|
||||
if type -f tmux &>/dev/null
|
||||
tmux attach >/dev/null 2>&1 || tmux new-session $argv
|
||||
else
|
||||
missing_package tmux
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function ta --wraps='tmux attach -t' --description 'alias ta=tmux attach -t'
|
||||
if type -f tmux &>/dev/null
|
||||
tmux attach -t $argv
|
||||
else
|
||||
missing_package tmux
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function v --wraps=nvim --description 'alias v=nvim'
|
||||
if type -f nvim &>/dev/null
|
||||
nvim $argv
|
||||
else
|
||||
missing_package nvim
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
function vcl --wraps='nvim --clean' --description 'alias vcl=nvim --clean'
|
||||
if type -f nvim &>/dev/null
|
||||
nvim --clean $argv
|
||||
else
|
||||
missing_package nvim
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue