'triton insts' default output changes

Change default short and --long output of 'triton insts' somewhat
per feedback from Angela.

I also dropped validFields and turned on dottedLookup so you can do
stuff like:
    triton insts -o shortid,name,tags.foo,metadata.root_authorized_keys
This commit is contained in:
Trent Mick 2015-08-31 13:11:31 -07:00
parent e145090c79
commit dfc3e013b6

View File

@ -20,38 +20,18 @@ var validFilters = [
'credentials' 'credentials'
]; ];
// valid output fields to be printed
var validFields = [
'id',
'name',
'type',
'state',
'dataset',
'memory',
'disk',
'ips',
'metadata',
'created',
'updated',
'package',
'image',
'img',
'ago',
'shortid'
];
function do_instances(subcmd, opts, args, callback) { function do_instances(subcmd, opts, args, callback) {
if (opts.help) { if (opts.help) {
this.do_help('help', {}, [subcmd], callback); this.do_help('help', {}, [subcmd], callback);
return; return;
} }
var columns = 'shortid,name,state,type,img,memory,disk,ago'.split(','); var columns = 'shortid,name,img,state,primaryIp,ago'.split(',');
if (opts.o) { if (opts.o) {
/* JSSTYLED */ /* JSSTYLED */
columns = opts.o.trim().split(/\s*,\s*/g); columns = opts.o.trim().split(/\s*,\s*/g);
} else if (opts.long) { } else if (opts.long) {
columns[0] = 'id'; columns = 'id,name,img,package,state,primaryIp,created'.split(',');
} }
/* JSSTYLED */ /* JSSTYLED */
var sort = opts.s.trim().split(/\s*,\s*/g); var sort = opts.s.trim().split(/\s*,\s*/g);
@ -116,7 +96,7 @@ function do_instances(subcmd, opts, args, callback) {
skipHeader: opts.H, skipHeader: opts.H,
columns: columns, columns: columns,
sort: sort, sort: sort,
validFields: validFields dottedLookup: true
}); });
} }
callback(); callback();
@ -151,8 +131,8 @@ do_instances.options = [
{ {
names: ['s'], names: ['s'],
type: 'string', type: 'string',
default: 'name', default: 'created',
help: 'Sort on the given fields. Default is "name".', help: 'Sort on the given fields. Default is "created".',
helpArg: 'field1,...' helpArg: 'field1,...'
}, },
{ {