Improve pkg-mgr configs
This commit is contained in:
parent
ac82f8a850
commit
c6ed25df84
13
conf.d/35_package_manager.fish
Normal file
13
conf.d/35_package_manager.fish
Normal file
@ -0,0 +1,13 @@
|
||||
# Package manager
|
||||
|
||||
# Supported:
|
||||
# ☑ apt
|
||||
# ☐ dnf
|
||||
# ☐ pacman
|
||||
# ☐ zypper
|
||||
# ☐ apk
|
||||
# ☐ xbps
|
||||
|
||||
set -g FISH_PACKAGE_MANAGER apt
|
||||
|
||||
fish_load_package_manager $FISH_PACKAGE_MANAGER
|
||||
@ -1,3 +0,0 @@
|
||||
# Package management
|
||||
|
||||
alias apt="apt -o APT::Color=1"
|
||||
@ -1,22 +0,0 @@
|
||||
# Package management
|
||||
|
||||
# Install / remove
|
||||
abbr inst "sudo apt install -y"
|
||||
abbr apti "sudo apt install -y"
|
||||
|
||||
abbr aptr "sudo apt remove"
|
||||
abbr aptp "sudo apt purge"
|
||||
|
||||
# Search / information
|
||||
abbr apts "apt search"
|
||||
abbr aptsh "apt show"
|
||||
|
||||
# Maintenance
|
||||
abbr aptu "sudo apt update"
|
||||
abbr aptug "sudo apt update && sudo apt full-upgrade"
|
||||
abbr apta "sudo apt autoremove"
|
||||
abbr aptc "sudo apt clean"
|
||||
abbr aptl "apt list --installed"
|
||||
|
||||
# Package files
|
||||
abbr aptf apt-file
|
||||
42
functions/fish_load_package_manager.fish
Normal file
42
functions/fish_load_package_manager.fish
Normal file
@ -0,0 +1,42 @@
|
||||
function fish_load_package_manager \
|
||||
--description "Load package-manager-specific aliases, abbreviations and functions"
|
||||
|
||||
if test (count $argv) -ne 1
|
||||
echo "Usage: fish_load_package_manager <package-manager>" >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
set -l pkg $argv[1]
|
||||
|
||||
set -l common_dir $__fish_config_dir/pkg/common
|
||||
set -l pkg_dir $__fish_config_dir/pkg/$pkg
|
||||
|
||||
if not test -d $pkg_dir
|
||||
echo "fish_load_package_manager: '$pkg' not found." >&2
|
||||
return 1
|
||||
end
|
||||
|
||||
# Common
|
||||
|
||||
test -f $common_dir/01_aliases.fish
|
||||
and source $common_dir/01_aliases.fish
|
||||
|
||||
test -f $common_dir/02_abbreviations.fish
|
||||
and source $common_dir/02_abbreviations.fish
|
||||
|
||||
if test -d $common_dir/functions
|
||||
set -a fish_function_path $common_dir/functions
|
||||
end
|
||||
|
||||
# Package-manager-specific
|
||||
|
||||
test -f $pkg_dir/01_aliases.fish
|
||||
and source $pkg_dir/01_aliases.fish
|
||||
|
||||
test -f $pkg_dir/02_abbreviations.fish
|
||||
and source $pkg_dir/02_abbreviations.fish
|
||||
|
||||
if test -d $pkg_dir/functions
|
||||
set -a fish_function_path $pkg_dir/functions
|
||||
end
|
||||
end
|
||||
@ -1,32 +0,0 @@
|
||||
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
|
||||
3
pkg/apt/01_aliases.fish
Normal file
3
pkg/apt/01_aliases.fish
Normal file
@ -0,0 +1,3 @@
|
||||
# APT
|
||||
|
||||
alias apt="apt -o APT::Color=1"
|
||||
45
pkg/apt/02_abbreviations.fish
Normal file
45
pkg/apt/02_abbreviations.fish
Normal file
@ -0,0 +1,45 @@
|
||||
# Common package management
|
||||
|
||||
# Install / remove
|
||||
abbr inst "sudo apt install -y"
|
||||
abbr uinst "sudo apt remove"
|
||||
abbr pkgrm "sudo apt remove"
|
||||
abbr purge "sudo apt purge"
|
||||
|
||||
# Upgrade / maintenance
|
||||
abbr upgr "sudo apt update && sudo apt full-upgrade -y"
|
||||
abbr autoremove "sudo apt autoremove -y"
|
||||
abbr pkgclean "sudo apt clean"
|
||||
|
||||
# Search / information
|
||||
abbr pkgsh "apt search"
|
||||
abbr pkginfo "apt show"
|
||||
abbr pkgls "apt list --installed"
|
||||
|
||||
# APT-specific
|
||||
|
||||
# Package relationships
|
||||
abbr pkgdep "apt-cache depends"
|
||||
abbr pkgrdep "apt-cache rdepends"
|
||||
|
||||
# Package policy / versions
|
||||
abbr pkgpolicy "apt-cache policy"
|
||||
abbr pkgmadison "apt-cache madison"
|
||||
|
||||
# Package ownership / files
|
||||
abbr pkgfiles "apt-file list"
|
||||
abbr pkgowner "dpkg -S"
|
||||
|
||||
# Installed package information
|
||||
abbr pkgstatus "dpkg -s"
|
||||
abbr pkgverify "debsums"
|
||||
|
||||
# Package database
|
||||
abbr pkgreset "sudo dpkg-reconfigure"
|
||||
|
||||
# Repository management
|
||||
abbr pkgsrc "sudo apt edit-sources"
|
||||
|
||||
# Package contents
|
||||
abbr pkgextract "dpkg-deb -x"
|
||||
abbr pkgcontents "dpkg-deb -c"
|
||||
17
pkg/apt/functions/updt.fish
Normal file
17
pkg/apt/functions/updt.fish
Normal file
@ -0,0 +1,17 @@
|
||||
function updt \
|
||||
--description "Update the system"
|
||||
|
||||
sudo apt update
|
||||
or return
|
||||
|
||||
sudo apt full-upgrade -y
|
||||
or return
|
||||
|
||||
sudo apt autoremove -y
|
||||
or return
|
||||
|
||||
sudo apt clean
|
||||
|
||||
updt_helpers
|
||||
updt_languages
|
||||
end
|
||||
11
pkg/common/functions/updt_helpers.fish
Normal file
11
pkg/common/functions/updt_helpers.fish
Normal file
@ -0,0 +1,11 @@
|
||||
function updt_helpers \
|
||||
--description "Update helper package managers"
|
||||
|
||||
if command -q flatpak
|
||||
flatpak update -y
|
||||
end
|
||||
|
||||
#if command -q snap
|
||||
# sudo snap refresh
|
||||
#end
|
||||
end
|
||||
27
pkg/common/functions/updt_languages.fish
Normal file
27
pkg/common/functions/updt_languages.fish
Normal file
@ -0,0 +1,27 @@
|
||||
function updt_languages \
|
||||
--description "Update language toolchains"
|
||||
|
||||
if command -q rustup
|
||||
rustup update
|
||||
end
|
||||
|
||||
if command -q pipx
|
||||
pipx upgrade-all
|
||||
end
|
||||
|
||||
if command -q npm
|
||||
npm update --location=global
|
||||
end
|
||||
|
||||
if command -q pnpm
|
||||
pnpm update --global
|
||||
end
|
||||
|
||||
if command -q yarn
|
||||
yarn global upgrade
|
||||
end
|
||||
|
||||
if command -q gem
|
||||
gem update
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user