Print a deprecation message if you use the old os configure format

This commit is contained in:
Tim Perry 2017-11-16 19:47:59 +01:00
parent e38a0c0047
commit 49d78c56fa
2 changed files with 10 additions and 0 deletions

View File

@ -212,6 +212,9 @@ exports.configure = {
if (_.filter([options.device, options.application, params.uuid]).length !== 1) { if (_.filter([options.device, options.application, params.uuid]).length !== 1) {
patterns.expectedError('To configure an image, you must provide exactly one of:\n\n* A device, with --device <uuid>\n* An application, with --app <appname>\n* [Deprecated] A device, passing its uuid directly on the command line\n\nSee the help page for examples:\n\n $ resin help os configure'); patterns.expectedError('To configure an image, you must provide exactly one of:\n\n* A device, with --device <uuid>\n* An application, with --app <appname>\n* [Deprecated] A device, passing its uuid directly on the command line\n\nSee the help page for examples:\n\n $ resin help os configure');
} }
if (params.uuid) {
console.warn('Directly passing a UUID to `resin os configure` is deprecated. Pass it with --uuid <uuid> instead.' + (params.deviceApiKey ? ' Device api keys can be passed with --deviceApiKey.\n' : '\n'));
}
uuid = options.device || params.uuid; uuid = options.device || params.uuid;
deviceApiKey = options.deviceApiKey || params.deviceApiKey; deviceApiKey = options.deviceApiKey || params.deviceApiKey;
console.info('Configuring operating system image'); console.info('Configuring operating system image');

View File

@ -252,6 +252,13 @@ exports.configure =
$ resin help os configure $ resin help os configure
''' '''
if params.uuid
console.warn(
'Directly passing a UUID to `resin os configure` is deprecated. Pass it with --uuid <uuid> instead.' +
if params.deviceApiKey
' Device api keys can be passed with --deviceApiKey.\n'
else '\n'
)
uuid = options.device || params.uuid uuid = options.device || params.uuid
deviceApiKey = options.deviceApiKey || params.deviceApiKey deviceApiKey = options.deviceApiKey || params.deviceApiKey