Merge lp:~qqwa-deactivatedaccount/command-not-found/add--no-failure-msg into lp:~command-not-found-developers/command-not-found/trunk

Proposed by qqwa
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 141
Merged at revision: 146
Proposed branch: lp:~qqwa-deactivatedaccount/command-not-found/add--no-failure-msg
Merge into: lp:~command-not-found-developers/command-not-found/trunk
Diff against target: 49 lines (+8/-19)
2 files modified
command-not-found (+4/-1)
zsh_command_not_found (+4/-18)
To merge this branch: bzr merge lp:~qqwa-deactivatedaccount/command-not-found/add--no-failure-msg
Reviewer Review Type Date Requested Status
Zygmunt Krynicki Approve
Review via email: mp+72972@code.launchpad.net

Description of the change

add this option see the diff

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

+1

review: Approve
142. By AJ

fix zsh integration

143. By AJ

use --no-failure-msg in zsh integration

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

A patch bleed from another branch but both are welcome to land

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'command-not-found'
2--- command-not-found 2011-08-25 09:49:51 +0000
3+++ command-not-found 2011-08-26 00:05:38 +0000
4@@ -49,10 +49,13 @@
5 parser.add_option('--ignore-installed', '--ignore-installed',
6 action='store_true', default=False,
7 help=_("ignore local binaries and display the available packages"))
8+ parser.add_option('--no-failure-msg',
9+ action='store_true', default=False,
10+ help=_("don't print '<command-name>: command not found'"))
11 (options, args) = parser.parse_args()
12 if len(args) == 1:
13 cnf = CommandNotFound(options.data_dir)
14- if not cnf.advise(args[0], options.ignore_installed):
15+ if not cnf.advise(args[0], options.ignore_installed) and not options.no_failure_msg:
16 print >>sys.stderr, _("%s: command not found") % args[0]
17
18 if __name__ == "__main__":
19
20=== modified file 'zsh_command_not_found'
21--- zsh_command_not_found 2011-08-15 08:19:48 +0000
22+++ zsh_command_not_found 2011-08-26 00:05:38 +0000
23@@ -4,22 +4,8 @@
24 # This script will look-up command in the database and suggest
25 # installation of packages available from the repository
26
27-# Pseudo-namespace cnf_
28-
29-function cnf_preexec() {
30- typeset -g cnf_command="${1%% *}"
31-}
32-
33-function cnf_precmd() {
34- (($? == 127)) && [ -n "$cnf_command" ] && [ -x /usr/lib/command-not-found ] && {
35- whence -- "$cnf_command" >& /dev/null ||
36- /usr/bin/python /usr/lib/command-not-found -- "$cnf_command"
37- unset cnf_command
38+if [[ -x /usr/lib/command-not-found ]] ; then
39+ function command_not_found_handler() {
40+ /usr/lib/command-not-found --no-failure-msg -- $1
41 }
42-}
43-
44-typeset -ga preexec_functions
45-typeset -ga precmd_functions
46-preexec_functions+=cnf_preexec
47-precmd_functions+=cnf_precmd
48-
49+fi

Subscribers

People subscribed via source and target branches