File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
src/plugins/terminal/scripts Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ export HOME=/home
77export TERM=xterm-256color
88
99
10- required_packages=" bash"
10+ required_packages=" bash command-not-found "
1111missing_packages=" "
1212
1313for pkg in $required_packages ; do
@@ -79,6 +79,24 @@ if [ -s /etc/acode_motd ]; then
7979 cat /etc/acode_motd
8080fi
8181
82+ command_not_found_handle() {
83+ local cmd="$1 "
84+ local pkg
85+ local green="\033[1;32m"
86+ local reset="\033[0m"
87+
88+ # Search for package providing the command
89+ pkg=$( apk search -x " cmd:$cmd " 2> /dev/null | awk -F' -[0-9]' ' {print $1}' | head -n 1)
90+
91+ if [ -n "$pkg " ]; then
92+ printf "The program %s is not installed. Install it by executing:\n ${green} apk add %s${reset} \n" "$cmd " "$pkg " >&2
93+ else
94+ printf "The program %s is not installed and no package provides it.\n" "$cmd " >&2
95+ fi
96+
97+ return 127
98+ }
99+
82100EOF
83101 fi
84102
You can’t perform that action at this time.
0 commit comments