joyent/node-triton#60 display vcpus in triton packages output

This commit is contained in:
Trent Mick 2015-12-16 10:56:22 -08:00
parent 5ea3b1862a
commit aa198b33c8
2 changed files with 17 additions and 2 deletions

View File

@ -2,6 +2,7 @@
## 3.4.1 (not yet released)
- #60 Display `vcpus` in `triton packages` output.
- Add `-d,--data <data>` option to `triton cloudapi`.
- Fix `triton rbac role ROLE`. Also get that command to have a stable order for the
displayed fields.

View File

@ -27,10 +27,10 @@ var validFilters = [
];
// columns default without -o
var columnsDefault = 'shortid,name,default,memory,swap,disk';
var columnsDefault = 'shortid,name,default,memory,swap,disk,vcpus';
// columns default with -l
var columnsDefaultLong = 'id,name,default,memory,swap,disk';
var columnsDefaultLong = 'id,name,default,memory,swap,disk,vcpus';
// sort default with -s
var sortDefault = '_groupPlus,memory';
@ -103,6 +103,7 @@ function do_packages(subcmd, opts, args, callback) {
precision: 1,
narrow: true
}, pkg.disk * 1024 * 1024);
pkg.vcpusHuman = pkg.vcpus === 0 ? '-' : pkg.vcpus;
}
}
if (!opts.p) {
@ -117,6 +118,9 @@ function do_packages(subcmd, opts, args, callback) {
case 'disk':
return {lookup: 'diskHuman', name: 'DISK',
align: 'right'};
case 'vcpus':
return {lookup: 'vcpusHuman', name: 'VCPUS',
align: 'right'};
default:
return c;
}
@ -150,12 +154,22 @@ do_packages.options = [
]);
do_packages.help = (
/* BEGIN JSSTYLED */
'List packgaes.\n'
+ '\n'
+ 'Usage:\n'
+ ' {{name}} packages\n'
+ '\n'
+ '{{options}}'
+ '\n'
+ 'Notes on some fields:\n'
+ '- The "memory" (a.k.a. RAM), "swap", and "disk" fields are shown in\n'
+ ' more human readable units in tabular output (i.e. if neither "-p" nor\n'
+ ' "-j" is specified.\n'
+ '- The "vcpus" field is only relevant for KVM instances. It is therefore\n'
+ ' typically set to zero for packages not intended for KVM usage. This\n'
+ ' zero is shown as "-" in tabular output.\n'
/* END JSSTYLED */
);
do_packages.aliases = ['pkgs'];