From dac5bfa2990194a0311ca65a7e0039d7c1368e7b Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Sun, 21 Nov 2021 16:30:43 +0000 Subject: [PATCH] feat(shell): record missing commands This is so we can later add some alias for commands I frequently get incorrect --- .../core/files/oh-my-zsh/custom/command-not-found.zsh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/site-modules/core/files/oh-my-zsh/custom/command-not-found.zsh b/site-modules/core/files/oh-my-zsh/custom/command-not-found.zsh index 104c1a3..ff7f3c6 100644 --- a/site-modules/core/files/oh-my-zsh/custom/command-not-found.zsh +++ b/site-modules/core/files/oh-my-zsh/custom/command-not-found.zsh @@ -2,12 +2,20 @@ # Custom command not found hander to add links to https://command-not-found.com # this gives a nice way to display how to install al command # +# The not found command are recorded before displaying the messages for the +# error. This will allow you to see the command that you are getting incorrect +# more and maybe add in alias for them. The below command will get all of the +# incorrect commands and sort them by the most used. +# +# cat ~/.command-not-found | cut -d" " -f 2 | sort | uniq -c | sort -n +# [[ -e /etc/zsh_command_not_found ]] && source /etc/zsh_command_not_found [[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && source /usr/share/doc/pkgfile/command-not-found.zsh command_not_found_handler () { [[ "$1" == '_'* ]] && return 1 + echo "$(date +%s) $@" >> $HOME/.command-not-found; echo " Command '$1' is not found.