File: zsh_command_not_found

package info (click to toggle)
command-not-found 0.2.38-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, wheezy
  • size: 1,248 kB
  • ctags: 199
  • sloc: python: 824; makefile: 42; sh: 18
file content (25 lines) | stat: -rw-r--r-- 715 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# (c) Zygmunt Krynicki 2007,
# Licensed under GPL, see COPYING for the whole text
#
# This script will look-up command in the database and suggest
# installation of packages available from the repository

# Pseudo-namespace cnf_

function cnf_preexec() {
    typeset -g cnf_command="${1%% *}"
}

function cnf_precmd() {
    (($?)) && [ -n "$cnf_command" ] && [ -x /usr/share/command-not-found/command-not-found ] && {
        whence -- "$cnf_command" >& /dev/null ||
            /usr/bin/python /usr/share/command-not-found/command-not-found -- "$cnf_command"
        unset cnf_command
    }
}

typeset -ga preexec_functions
typeset -ga precmd_functions
preexec_functions+=cnf_preexec
precmd_functions+=cnf_precmd