Files
John R. Lenton 986060709a cmd/snap, tests: refactor info to unify handling of 'direct' snaps
Before this change, info's handling of 'direct' snaps (i.e. `snap info
foo.snap` and `snap info ./foo`) used a separate codepath from the
handling of locally-installed snaps and remote snaps. This led to the
output for direct snaps to diverge more than necessary from the output
of snaps that snapd knew about, as well as to some code duplication.

This change fixes that: before,
```
~$ snap info basic-desktop_1.0_all.snap
path:    "basic-desktop_1.0_all.snap"
name:    basic-desktop
summary: ""
version: 1.0 -
```
and now,
```
~$ snap info basic-desktop_1.0_all.snap
path:       "basic-desktop_1.0_all.snap"
name:       basic-desktop
summary:    ""
version:    1.0 -
build-date: today at 11:24 GMT
license:    GPL-3.0
description: |
  A basic snap with desktop apps
commands:
  - basic-desktop.echo
  - basic-desktop.echoecho
```

Furthermore, in verbose mode, this change adds errors for each of the
methods that were tried and failed, when they all failed:

```
$ snap info potato --verbose
error: treating "potato" as a path to a snap: cannot open snap: open potato: no such file or directory
error: treating "potato" as a locally-installed snap name: cannot retrieve snap "potato": snap not installed
error: treating "potato" as a snap name in the store: cannot find snap "potato": snap not found
error: no snap found for "potato"
```
2019-03-05 11:26:32 +00:00
..