juju status --format=tabular

John Meinel john at arbash-meinel.com
Thu Feb 19 04:07:27 UTC 2015


I was wondering if we could change the sorting to be "numeric" aware
instead of just alphabetical.

Specifically if you have more than 10 units you get:
[Units]
ID         STATE   VERSION MACHINE PORTS PUBLIC-ADDRESS

ubuntu/0   started 1.18.4  1             ec2-54-220-86-118.eu-we...
ubuntu/1   started 1.18.4  2             ec2-54-155-143-100.eu-w...
ubuntu/10  started 1.18.4  1             ec2-54-220-86-118.eu-we...
ubuntu/100 started 1.18.4  1             ec2-54-220-86-118.eu-we...
ubuntu/101 started 1.18.4  2             ec2-54-155-143-100.eu-w...
ubuntu/102 started 1.18.4  3             ec2-54-74-157-229.eu-we...
ubuntu/103 started 1.18.4  4             ec2-54-220-194-242.eu-w...
ubuntu/104 started 1.18.4  5             ec2-54-246-53-159.eu-we...
ubuntu/11  started 1.18.4  2             ec2-54-155-143-100.eu-w...
...

Which is not ideal IMO. Since we *know* that units are in the form
SERVICE/NUMBER can we do numerical sorting on the second part of the field?

Martin Pool wrote a really nice natural order string comparison utility
which we could borrow:
http://sourcefrog.net/projects/natsort/

John
=:->
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju-dev/attachments/20150219/ad8bb909/attachment.html>


More information about the Juju-dev mailing list