From 3bd22281e159a19387954ba354c91468921fa725 Mon Sep 17 00:00:00 2001 From: Trent Mick Date: Tue, 25 Aug 2015 21:06:27 -0700 Subject: [PATCH] 'triton image NAME', 'triton package NAME' --- lib/do_image.js | 18 +++++++++--------- lib/do_package.js | 17 ++++++++--------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/lib/do_image.js b/lib/do_image.js index 5d176b8..fe98d85 100644 --- a/lib/do_image.js +++ b/lib/do_image.js @@ -18,10 +18,7 @@ function do_image(subcmd, opts, args, callback) { 'incorrect number of args (%d): %s', args.length, args.join(' ')))); } - var getOpts = { - id: args[0] - }; - this.triton.cloudapi.getImage(getOpts, function onRes(err, img) { + this.triton.getImage(args[0], function onRes(err, img) { if (err) { return callback(err); } @@ -51,13 +48,16 @@ do_image.help = ( /* BEGIN JSSTYLED */ 'Get an image.\n' + '\n' + - 'Note: Currently this dumps prettified JSON by default. That might change\n' + - 'in the future. Use "-j" to explicitly get JSON output.\n' + - '\n' + 'Usage:\n' + - ' {{name}} image [] ID\n' + + ' {{name}} image [] ID|NAME\n' + '\n' + - '{{options}}' + '{{options}}' + + '\n' + + 'If there are more than one image with the given "NAME", the latest\n' + + 'image (by "published_at") is returned.\n' + + '\n' + + 'Note: Currently this dumps prettified JSON by default. That might change\n' + + 'in the future. Use "-j" to explicitly get JSON output.\n' /* END JSSTYLED */ ); diff --git a/lib/do_package.js b/lib/do_package.js index ce8a92f..2e9318b 100644 --- a/lib/do_package.js +++ b/lib/do_package.js @@ -18,10 +18,7 @@ function do_package(subcmd, opts, args, callback) { 'incorrect number of args (%d): %s', args.length, args.join(' ')))); } - var getOpts = { - id: args[0] - }; - this.triton.cloudapi.getPackage(getOpts, function onRes(err, pkg) { + this.triton.getPackage(args[0], function onRes(err, pkg) { if (err) { return callback(err); } @@ -51,13 +48,15 @@ do_package.help = ( /* BEGIN JSSTYLED */ 'Get a package.\n' + '\n' + - 'Note: Currently this dumps prettified JSON by default. That might change\n' + - 'in the future. Use "-j" to explicitly get JSON output.\n' + - '\n' + 'Usage:\n' + - ' {{name}} package [] ID\n' + + ' {{name}} package [] ID|NAME\n' + '\n' + - '{{options}}' + '{{options}}' + + '\n' + + 'The given "NAME" must be a unique match.\n' + + '\n' + + 'Note: Currently this dumps prettified JSON by default. That might change\n' + + 'in the future. Use "-j" to explicitly get JSON output.\n' /* END JSSTYLED */ );