Merge lp:~mvo/command-not-found/install-prompt-env into lp:~command-not-found-developers/command-not-found/trunk

Proposed by Michael Vogt
Status: Merged
Merged at revision: 148
Proposed branch: lp:~mvo/command-not-found/install-prompt-env
Merge into: lp:~command-not-found-developers/command-not-found/trunk
Diff against target: 25 lines (+5/-0)
2 files modified
CommandNotFound/CommandNotFound.py (+2/-0)
README (+3/-0)
To merge this branch: bzr merge lp:~mvo/command-not-found/install-prompt-env
Reviewer Review Type Date Requested Status
voltlick (community) Needs Fixing
Chozabu (community) Needs Fixing
Zygmunt Krynicki Approve
Review via email: mp+88319@code.launchpad.net

Description of the change

This branch makes the install prompt conditional on the environemt COMMAND_NOT_FOUND_INSTALL_PROMPT as not everybody likes this new interactive feature.

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

Thanks, +1

review: Approve
Revision history for this message
voltlick (luke-stanley) wrote :

The default is not helpful to most people. This patch should be reversed.
I'm also considering asking the user if copying "sudo apt-get install [whatever command]" to the clipboard or bash history should be done as that may be faster than debating here.

review: Disapprove
Revision history for this message
Chozabu (chozabu) wrote :

Seconded, I think most people would prefer:

        if "DISABLE_COMMAND_NOT_FOUND_INSTALL_PROMPT" in os.environ:
            return

to
        if not "COMMAND_NOT_FOUND_INSTALL_PROMPT" in os.environ:
            return

Those that don't like the prompt would be much more apt at disabling it than those don't even know of its existence.
It's good to have the option to disable, but why by default?

review: Needs Fixing
Revision history for this message
voltlick (luke-stanley) :
review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CommandNotFound/CommandNotFound.py'
2--- CommandNotFound/CommandNotFound.py 2011-12-09 22:56:07 +0000
3+++ CommandNotFound/CommandNotFound.py 2012-01-12 09:19:06 +0000
4@@ -191,6 +191,8 @@
5 return (yidx - xidx) or cmp(x, y)
6
7 def install_prompt(self, package_name):
8+ if not "COMMAND_NOT_FOUND_INSTALL_PROMPT" in os.environ:
9+ return
10 if package_name:
11 answer = raw_input(_("Do you want to install it? (N/y)"))
12 if sys.stdin.encoding and isinstance(answer, str):
13
14=== modified file 'README'
15--- README 2007-03-20 17:06:10 +0000
16+++ README 2012-01-12 09:19:06 +0000
17@@ -1,6 +1,9 @@
18 This application implements the command-not-found spec at:
19 https://wiki.ubuntu.com/CommandNotFoundMagic
20
21+If you want automatic prompts to install the package, set
22+COMMAND_NOT_FOUND_INSTALL_PROMPT in your environment.
23+
24 To use it in bash, please add the following line to your .bashrc file:
25 . /etc/bash_command_not_found
26

Subscribers

People subscribed via source and target branches