~ubuntu-branches/ubuntu/lucid/command-not-found/lucid

« back to all changes in this revision

Viewing changes to zsh_command_not_found

  • Committer: Bazaar Package Importer
  • Author(s): Johan Kiviniemi
  • Date: 2009-05-15 22:13:00 UTC
  • Revision ID: james.westby@ubuntu.com-20090515221300-7s8jihdd786cqueh
Tags: 0.2.35ubuntu1
* zsh_command_not_found:
  - Use the pseudo-namespace prefix cnf_ for everything.
  - Append the preexec/precmd functions to zsh’s pre*_functions arrays,
    allowing other pre* functions to be used simultaneously.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
# This script will look-up command in the database and suggest
5
5
# installation of packages available from the repository
6
6
 
7
 
function preexec() {
8
 
        command="${1%% *}"
 
7
# Pseudo-namespace cnf_
 
8
 
 
9
function cnf_preexec() {
 
10
        typeset -g cnf_command="${1%% *}"
9
11
}
10
12
 
11
 
function precmd() {
12
 
        (($?)) && [ -n "$command" ] && [ -x /usr/lib/command-not-found ] && {
13
 
                whence -- "$command" >& /dev/null ||
14
 
                        /usr/bin/python /usr/lib/command-not-found -- "$command"
15
 
                unset command
 
13
function cnf_precmd() {
 
14
        (($?)) && [ -n "$cnf_command" ] && [ -x /usr/lib/command-not-found ] && {
 
15
                whence -- "$cnf_command" >& /dev/null ||
 
16
                        /usr/bin/python /usr/lib/command-not-found -- "$cnf_command"
 
17
                unset cnf_command
16
18
        }
17
19
}
18
20
 
 
21
typeset -ga preexec_functions
 
22
typeset -ga precmd_functions
 
23
preexec_functions+=cnf_preexec
 
24
precmd_functions+=cnf_precmd
 
25