 resin = require('resin-sdk')
 os = require('os')
 visuals = require('resin-cli-visuals')
+drivelist = require('drivelist')
 commandOptions = require('./command-options')
 drive = require('../drive/drive')
 

		_.each(devices, _.unary(console.log))

exports.init =
	signature: 'device init <image> <device>'
	description: 'write an operating system image to a device'
	help: '''
		Use this command to write an operating system image to a device.

		Note that this command requires admin privileges.

		Notice this command asks for confirmation interactively.
		You can avoid this by passing the `--yes` boolean option.

		async.waterfall [

			(callback) ->
				return callback(null, params.device) if params.device?

				drivelist.list (error, drives) ->
					return callback(error) if error?

					drives = _.map drives, (item) ->
						return {
							name: "#{item.device} (#{item.size}) - #{item.description}"
							value: item.device
						}

					visuals.widgets.select('Select a drive', drives, callback)

			(device, callback) ->
				params.device = device

				if options.yes
					return callback(null, true)
				else
