c-n-f should be able offer to install missing programs (preference)

Bug #224776 reported by Thomas van der Burgt
40
This bug affects 2 people
Affects Status Importance Assigned to Milestone
command-not-found
Fix Released
Wishlist
Zygmunt Krynicki
command-not-found (Ubuntu)
Triaged
Wishlist
Unassigned

Bug Description

Binary package hint: gnome-terminal

Instead of saying:
The program 'x' is currently not installed. You can install it by typing:
sudo apt-get install x
bash: x: command not found

It should promt me to install it like:

The program 'x' is currently not installed. Would you like to install it now [Y]?:

ProblemType: Bug
Architecture: i386
Date: Wed Apr 30 17:08:56 2008
DistroRelease: Ubuntu 8.04
ExecutablePath: /usr/bin/gnome-terminal
NonfreeKernelModules: nvidia
Package: gnome-terminal 2.22.1-0ubuntu2
PackageArchitecture: i386
ProcEnviron:
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: gnome-terminal
Uname: Linux 2.6.24-16-generic i686

Tags: apport-bug
Revision history for this message
Thomas van der Burgt (thvdburgt) wrote :
description: updated
Revision history for this message
Ralph Corderoy (ralph-inputplus) wrote :

I don't think this is such a good idea. I often mistype a command. By chance, it's found in some package I've not heard of. Meanwhile, while the search was on-going, I've realised my mistake and entered the correct command before continuing to type ahead. If that corrected command was consumed as the answer to `would you like to install it now?' then my later commands may have problems, e.g. the `cd' was consumed and the `rm' was acting somewhere other than intended.

Colin Watson (cjwatson)
Changed in command-not-found:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Sean Stoops (brutimus) wrote :

I fully agree with Ralph. I don't want to have to answer a question every time I mistype a command.

Michael Vogt (mvo)
Changed in command-not-found (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

This functionality is coming in 0.4.x alpha (as a preference)

summary: - When a program is not installed and used in the cli it should ask me if
- I want to install it not how to install it
+ c-n-f should be able offer to install missing programs (preference)
Changed in command-not-found:
importance: Undecided → Wishlist
milestone: none → alpha
status: New → Confirmed
Zygmunt Krynicki (zyga)
Changed in command-not-found:
assignee: nobody → Zygmunt Krynicki (zkrynicki)
status: Confirmed → In Progress
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Committed in revision 113 of lp:command-not-found

Changed in command-not-found:
status: In Progress → Fix Released
status: Fix Released → Fix Committed
Zygmunt Krynicki (zyga)
Changed in command-not-found:
milestone: none → 0.2.41
Revision history for this message
Sean Stoops (brutimus) wrote :

I was just looking over "revision 113 of lp:command-not-found" to see how this feature was implemented. The one thing that concerns me is that the "ask" appears to be the default value. In other words, if I type in a non-existent command, if it matches a known command, it will force me to answer 'y' or 'n'.

My first question, how will a user come to find out how to turn this off. I certainly don't want this feature as I spend 90% of my day in the shell and am a horrible typer. :-) I'm not saying "ask" shouldn't be the default value, but I would like to see a very simple way to turn it off, even if it's a message on the first occurrence of something like: "To turn this feature off, change X value in Y config file"

Thoughts?

Revision history for this message
kevin (keg) wrote :

I agree with what others are saying. Having a default action waiting for input on a mistype would be very annoying.

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

I have created a PPA with this feature, I will upload the package this evening.
I think you have to use it for a moment first to decide if we should keep 'ask' as default.
The one major factor is that the question is offered *only* if you type exact command name that is available.
It does not trigger on spelling suggestion. It does not trigger when command is in multiple packages.
I think it actually makes sense to offer that question in the case when the user had intended to run the comma d anyway.

If mvo pushes this to lucid we can get wider feedback

Zygmunt Krynicki (zyga)
Changed in command-not-found:
status: Fix Committed → Fix Released
Revision history for this message
Anton Yakutovich (dr-akulavich) wrote :

It works! I like this feature. Thank you, Zygmunt!
Could you add snaphot for Maverick in PPA?

Revision history for this message
Serhiy (xintx-ua) wrote :

I just found this bug in process of getting to bug #880616
Zygmunt, did you mean
http://bazaar.launchpad.net/~command-not-found-developers/command-not-found/trunk/revision/113 revision ? There is no code for this, so I assume I missed something.
And I agree with Sean that it should be configurable. Are there any configuration file for c-n-f? I didn't see them in package.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.