smira/aptly — pull request #73 by simonaquino (2014-06-30 18:51:48+00:00)
Title: List snapshots by time

Users have now the choice of listing the snapshot by creation time as well as name (lexicographic / default behaviour).
An additional flag has been added '--sort=' which controls the sort strategy applied to the list produced by aptly snapshot list.

The possible values are:
--sort=name (default): sorts the snapshot list by name (lexicographic order)
--sort=time: sorts the snapshot list in chronological order (oldest to newest)

For example:

I've created the snapshots in the following order:
```
root@sim-tst-lb1:~# aptly snapshot create snap1 empty
...
root@sim-tst-lb1:~# aptly snapshot create rabbitmq from mirror rabbitmq
...
root@sim-tst-lb1:~# aptly snapshot create repo from repo local
...
root@sim-tst-lb1:~# aptly snapshot create elasticsearch from mirror elasticsearch
...
```
```aptly snapshot list (-sort=name)``` produces the following output:
```
root@sim-tst-lb1:~# aptly snapshot list
List of snapshots:
* [elasticsearch]: Snapshot from mirror [elasticsearch]: http://packages.elasticsearch.org/elasticsearch/1.2/debian/ stable
* [rabbitmq]: Snapshot from mirror [rabbitmq]: http://www.rabbitmq.com/debian/ testing
* [repo]: Snapshot from local repo [local]
* [snap1]: Created as empty

To get more information about snapshot, run `aptly snapshot show `.
```
```aptly -sort=time snapshot list``` produces the following output:
```
root@sim-tst-lb1:~# aptly -sort=time snapshot list
List of snapshots:
* [snap1]: Created as empty
* [rabbitmq]: Snapshot from mirror [rabbitmq]: http://www.rabbitmq.com/debian/ testing
* [repo]: Snapshot from local repo [local]
* [elasticsearch]: Snapshot from mirror [elasticsearch]: http://packages.elasticsearch.org/elasticsearch/1.2/debian/ stable

To get more information about snapshot, run `aptly snapshot show `.
```
The -raw behaviour stays unchanged:
```
root@sim-tst-lb1:~# aptly -sort=time -raw snapshot list
snap1
rabbitmq
repo
elasticsearch
```
Integration tests have been added.