This commit is contained in:
2025-03-30 01:32:05 +04:00
parent fc75c3ef8b
commit 4ba1e8cad0
3 changed files with 40 additions and 2 deletions

17
.zshrc
View File

@@ -98,6 +98,23 @@ done | sort
return 0
}
compdef myalias
sshc() {
local RED=$(tput setaf 1)
local GREEN=$(tput setaf 2)
local normal=$(tput sgr0)
echo "My custom aliases SSH-config:"
printf "%-18s %s\n" "Name" "Hostname"
echo "------------------------------"
# cat ~/.ssh/config.d/$1.conf | while read line || [[ -n $line ]];
# do
for file in ~/.ssh/config.d/$1.conf; do
host=$(grep -w 'Host' $file | awk '{print $2}')
command=$(grep -w 'HostName' $file | awk '{print $2}')
printf "%-25s %s\n" "${RED}$host${normal}" "${GREEN}$command${normal}"
done
return 0
}
compdef myalias
# Load files alias
if [ -f ~/.dotfiles/alias/zsh_aliases ]; then
. ~/.dotfiles/alias/zsh_aliases