Syntax tweaks for snap-friendly output

Bug #1749777 reported by Mark Shuttleworth
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
command-not-found
Fix Released
Critical
Unassigned
command-not-found (Ubuntu)
Fix Released
Critical
Unassigned

Bug Description

Would it be possible to change 'found' to 'installed', and show potential versions? For example:

$ aws
The program 'aws' can be installed as:
 * snap 'aws-cli' (1.14.38)
 * deb 'awscli' (1.14.36-1)

Revision history for this message
Mark Shuttleworth (sabdfl) wrote :

Perhaps this would be a better format:

$ aws

The command 'aws' can be installed as:

 snap aws-cli (1.14.38)
 deb awscli (1.14.36-1)

See 'snap info aws-cli' for additional versions.

Revision history for this message
Michael Vogt (mvo) wrote :

We are working on improving this currently. Right now c-n-f has no version concept for the apt backend (easy for snaps). But we have a plan how to fix that (some work though).

Changed in command-not-found (Ubuntu):
importance: Undecided → Critical
status: New → In Progress
Revision history for this message
Mark Shuttleworth (sabdfl) wrote : Re: [Bug 1749777] Re: Syntax tweaks for snap-friendly output

On 02/21/2018 01:36 PM, Michael Vogt wrote:
> We are working on improving this currently. Right now c-n-f has no
> version concept for the apt backend (easy for snaps). But we have a plan
> how to fix that (some work though).

For the apt version, I thought we would just display the current version
of the package in the Packages file.

Mark

Michael Vogt (mvo)
Changed in command-not-found:
status: New → In Progress
importance: Undecided → Critical
Revision history for this message
Nish Aravamudan (nacc) wrote :

I think it is an UX regression to go from:

$ sl
The program 'sl' is currently not installed. You can install it by typing:
sudo apt install sl

to (hypothetically):

$ sl
The command 'sl' can be installed as:
 snap sl
 deb sl

Because in fact neither of those are correct commands to install 'sl' :)

Why was this done this way?

Please minimally for the apt packages, use the same verbage (which users are comfortable with and can c&p) as the previous c-n-f implementation.

Also, why can the snap packages not be provided with a similar `snap install...` output (with sudo or not, as appropriate, I guess).

If a user does not know what a snap is, they are not given sufficient information from the c-n-f output to know what to do with the information now, which should be (IMO) consider a UX regression. And if something is both a snap and deb, they now are not given c&p commands to run.

Revision history for this message
Seth Arnold (seth-arnold) wrote :

I liked that the 'existing' version of command-not-found was explicit about the action to take:

$ aws
The program 'aws' is currently not installed. You can install it by typing:
sudo apt install awscli

A triple-click followed by middle-click was sufficient to follow the instructions, and the surrounding text felt friendly. Perhaps this model could be kept, and give the version number information after a # so the shell ignores it with the triple-click middle-click routine?

Thanks

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

I'm also much more fond of the original output (that I mostly wrote) because it was actionable. When doing the format transition we lost the intent of the tool. To help novice users install packages that they may not be familiar with.

Revision history for this message
David Britton (dpb) wrote :

Just copying over my description from Bug #1752185 here for reference:

--------------------------------

Bionic:

dpb@bierstadt:~[]$ jq
The program 'jq' can be found:
 + snap 'jq'
 * deb 'jq'

Xenial:

dpb@helo:~[]$ jq
The program 'jq' is currently not installed. You can install it by typing:
sudo apt install jq

--------------------------------

Some Observations that could use cleaning up:

1) why '+' for one and '*' for the other?

2) Neither of these things printed were as nice as what shows up on xenial, missing what the problem was: "program not currently installed", and the what the solution is. Perhaps s/can/cannot/? Still I prefer the previous reading in c-n-f.

3) Users may not be familiar with what 'deb' is, or what 'snap' is for that matter. They are more likely focused on the thing that can help solve their problem (sudo snap install jq, sudo apt install jq).

Versions used:

ii command-not-found 0.3ubuntu18.04.0~pre4 all Suggest installation of packages in interactive bash sessions
ii command-not-found-data 0.3ubuntu18.04.0~pre4 amd64 Set of data files for command-not-found.
ii python3-commandnotfound 0.3ubuntu18.04.0~pre4 all Python 3 bindings for command-not-found.

Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

Yeah, we spent a lot of time trying to make the output both compact and showing command lines. The problem is that once you have more than a few options, it gets wild and unfriendly as a dump of information after a typo.

That said, I think we can improve these headings indeed. The output I see above ("foo can be found") disagrees with what we discussed, and what is in the top proposal in this ticket. We need to improve this. The + vs * also looks like a typo.

Revision history for this message
Michael Vogt (mvo) wrote :

The current output (in lp:command-not-found) looks like this:

Mixed snaps/debs:
"""
$ jq

The command 'jq' can be installed as:

 snap jq
 deb jq (1.5+dfsg-2)

See 'snap info jq' for additional versions.

"""

Single snap:
"""
$ spotify

The command 'spotify' can be installed from the following snaps:

 spotify

See 'snap info spotify' for additional versions.

"""

Sinle deb:
"""
The command 'konsole' can be intsalled by typing:
sudo apt install konsole
"""

Multiple debs:
"""

The command 'vim' can be installed from the following apt packages:

 vim
 vim-gtk3
 vim-tiny
 neovim
 vim-athena
 vim-gtk
 vim-nox

Try: sudo apt install <selected package>

"""

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package command-not-found - 18.04.0~pre1

---------------
command-not-found (18.04.0~pre1) bionic; urgency=medium

  * New version:
    - switch from gdbm to sqlite (smaller files and faster searches)
    - will fetch "dists/bionic/*/binary-*/cnf/Commands-* files
      once the archive provides them
    - CLI output follows what is outlined in LP: #1749777
    - command-not-found-data switched to consume Commands-* files
      (package can be dropped/emptied once server side Commands-* files
       are available)
    - support for suggestions based on snap packages
    - add autopkgtest to the package

 -- Michael Vogt <email address hidden> Wed, 28 Feb 2018 14:26:58 +0100

Changed in command-not-found (Ubuntu):
status: In Progress → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote :

The output in Eoan today currently looks like the following:

 $ aws

Command 'aws' not found, but can be installed with:

sudo snap install aws-cli # version 1.16.148, or
sudo apt install awscli # version 1.16.113-1

See 'snap info aws-cli' for additional versions.

This seems to be friendly for both the snap and apt use cases.

Changed in command-not-found:
status: In Progress → Fix Released
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.