Merge pull request #228 from resin-io/jviotti/feature/os-initialize-drive

Support drive option in os initialize
This commit is contained in:
Juan Cruz Viotti 2015-10-15 08:49:26 -04:00
commit 0ba914236a
3 changed files with 29 additions and 5 deletions

View File

@ -104,14 +104,27 @@
description: 'initialize an os image',
help: 'Use this command to initialize a previously configured operating system image.\n\nExamples:\n\n $ resin os initialize ../path/rpi.img \'raspberry-pi\'',
permission: 'user',
options: [commandOptions.yes],
options: [
commandOptions.yes, {
signature: 'drive',
description: 'drive',
parameter: 'drive',
alias: 'd'
}
],
root: true,
action: function(params, options, done) {
console.info('Initializing device');
return resin.models.device.getManifestBySlug(params.type).then(function(manifest) {
var ref;
return (ref = manifest.initialization) != null ? ref.options : void 0;
}).then(form.run).tap(function(answers) {
}).then(function(questions) {
return form.run(questions, {
override: {
drive: options.drive
}
});
}).tap(function(answers) {
var message;
if (answers.drive == null) {
return;

View File

@ -106,14 +106,25 @@ exports.initialize =
$ resin os initialize ../path/rpi.img 'raspberry-pi'
'''
permission: 'user'
options: [ commandOptions.yes ]
options: [
commandOptions.yes
{
signature: 'drive'
description: 'drive'
parameter: 'drive'
alias: 'd'
}
]
root: true
action: (params, options, done) ->
console.info('Initializing device')
resin.models.device.getManifestBySlug(params.type)
.then (manifest) ->
return manifest.initialization?.options
.then(form.run)
.then (questions) ->
return form.run questions,
override:
drive: options.drive
.tap (answers) ->
return if not answers.drive?
message = "This will erase #{answers.drive}. Are you sure?"

View File

@ -51,7 +51,7 @@
"open": "0.0.5",
"resin-cli-errors": "^1.0.0",
"resin-cli-events": "^1.0.2",
"resin-cli-form": "^1.2.1",
"resin-cli-form": "^1.3.0",
"resin-cli-visuals": "^1.2.2",
"resin-config-inject": "^2.0.0",
"resin-device-config": "^1.0.0",