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
=== modified file 'CommandNotFound/CommandNotFound.py'
--- CommandNotFound/CommandNotFound.py 2011-12-09 22:56:07 +0000
+++ CommandNotFound/CommandNotFound.py 2012-01-12 09:19:06 +0000
@@ -191,6 +191,8 @@
191 return (yidx - xidx) or cmp(x, y)191 return (yidx - xidx) or cmp(x, y)
192192
193 def install_prompt(self, package_name):193 def install_prompt(self, package_name):
194 if not "COMMAND_NOT_FOUND_INSTALL_PROMPT" in os.environ:
195 return
194 if package_name:196 if package_name:
195 answer = raw_input(_("Do you want to install it? (N/y)"))197 answer = raw_input(_("Do you want to install it? (N/y)"))
196 if sys.stdin.encoding and isinstance(answer, str):198 if sys.stdin.encoding and isinstance(answer, str):
197199
=== modified file 'README'
--- README 2007-03-20 17:06:10 +0000
+++ README 2012-01-12 09:19:06 +0000
@@ -1,6 +1,9 @@
1This application implements the command-not-found spec at:1This application implements the command-not-found spec at:
2https://wiki.ubuntu.com/CommandNotFoundMagic2https://wiki.ubuntu.com/CommandNotFoundMagic
33
4If you want automatic prompts to install the package, set
5COMMAND_NOT_FOUND_INSTALL_PROMPT in your environment.
6
4To use it in bash, please add the following line to your .bashrc file:7To use it in bash, please add the following line to your .bashrc file:
5. /etc/bash_command_not_found8. /etc/bash_command_not_found
69

Subscribers

People subscribed via source and target branches