dedupe the shared options

This commit is contained in:
Eugene Mirotin 2017-06-15 00:51:56 +03:00
parent d2a9aee685
commit 8bdacbb11e
7 changed files with 42 additions and 66 deletions

View File

@ -84,3 +84,17 @@ exports.forceUpdateLock = {
boolean: true,
alias: 'f'
};
exports.drive = {
signature: 'drive',
description: 'the drive to write the image to, like `/dev/sdb` or `/dev/mmcblk0`. Careful with this as you can erase your hard drive. Check `resin util available-drives` for available options.',
parameter: 'drive',
alias: 'd'
};
exports.advancedConfig = {
signature: 'advanced',
description: 'show advanced configuration options',
boolean: true,
alias: 'v'
};

View File

@ -264,20 +264,10 @@ exports.init = {
description: 'initialise a device with resinOS',
help: 'Use this command to download the OS image of a certain application and write it to an SD Card.\n\nNotice this command may ask for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n\n $ resin device init\n $ resin device init --application MyApp',
options: [
commandOptions.optionalApplication, commandOptions.yes, {
signature: 'advanced',
description: 'enable advanced configuration',
boolean: true,
alias: 'v'
}, _.assign({}, commandOptions.osVersion, {
commandOptions.optionalApplication, commandOptions.yes, commandOptions.advancedConfig, _.assign({}, commandOptions.osVersion, {
signature: 'os-version',
parameter: 'os-version'
}), {
signature: 'drive',
description: 'the drive to write the image to, like `/dev/sdb` or `/dev/mmcblk0`. Careful with this as you can erase your hard drive. Check `resin util available-drives` for available options.',
parameter: 'drive',
alias: 'd'
}, {
}), commandOptions.drive, {
signature: 'config',
description: 'path to the config JSON file, see `resin os build-config`',
parameter: 'config'

View File

@ -165,12 +165,7 @@ exports.buildConfig = {
help: 'Use this command to prebuild the OS config once and skip the interactive part of `resin os configure`.\n\nExamples:\n\n $ resin os build-config ../path/rpi3.img raspberrypi3 --output rpi3-config.json\n $ resin os configure ../path/rpi3.img 7cf02a6 --config "$(cat rpi3-config.json)"',
permission: 'user',
options: [
{
signature: 'advanced',
description: 'show advanced commands',
boolean: true,
alias: 'v'
}, {
commandOptions.advancedConfig, {
signature: 'output',
description: 'the path to the output JSON file',
alias: 'o',
@ -195,12 +190,7 @@ exports.configure = {
help: 'Use this command to configure a previously downloaded operating system image for the specific device.\n\nExamples:\n\n $ resin os configure ../path/rpi.img 7cf02a6',
permission: 'user',
options: [
{
signature: 'advanced',
description: 'show advanced commands',
boolean: true,
alias: 'v'
}, {
commandOptions.advancedConfig, {
signature: 'config',
description: 'path to the config JSON file, see `resin os build-config`',
parameter: 'config'
@ -240,12 +230,7 @@ exports.initialize = {
parameter: 'type',
alias: 't',
required: 'You have to specify a device type'
}, {
signature: 'drive',
description: 'drive to write the image to. Check `resin util available-drives` for available options.',
parameter: 'drive',
alias: 'd'
}
}, commandOptions.drive
],
action: function(params, options, done) {
var Promise, form, helpers, patterns, umountAsync;

View File

@ -481,7 +481,7 @@ confirm non interactively
#### --advanced, -v
enable advanced configuration
show advanced configuration options
#### --os-version <os-version>
@ -892,7 +892,7 @@ Examples:
#### --advanced, -v
show advanced commands
show advanced configuration options
#### --output, -o <output>
@ -910,7 +910,7 @@ Examples:
#### --advanced, -v
show advanced commands
show advanced configuration options
#### --config <config>
@ -939,7 +939,7 @@ device type (Check available types with `resin devices supported`)
#### --drive, -d <drive>
drive to write the image to. Check `resin util available-drives` for available options.
the drive to write the image to, like `/dev/sdb` or `/dev/mmcblk0`. Careful with this as you can erase your hard drive. Check `resin util available-drives` for available options.
# Config

View File

@ -78,3 +78,17 @@ exports.forceUpdateLock =
description: 'force action if the update lock is set'
boolean: true
alias: 'f'
exports.drive =
signature: 'drive'
description: 'the drive to write the image to, like `/dev/sdb` or `/dev/mmcblk0`.
Careful with this as you can erase your hard drive.
Check `resin util available-drives` for available options.'
parameter: 'drive'
alias: 'd'
exports.advancedConfig =
signature: 'advanced'
description: 'show advanced configuration options'
boolean: true
alias: 'v'

View File

@ -370,21 +370,9 @@ exports.init =
options: [
commandOptions.optionalApplication
commandOptions.yes
{
signature: 'advanced'
description: 'enable advanced configuration'
boolean: true
alias: 'v'
}
commandOptions.advancedConfig
_.assign({}, commandOptions.osVersion, { signature: 'os-version', parameter: 'os-version' })
{
signature: 'drive'
description: 'the drive to write the image to, like `/dev/sdb` or `/dev/mmcblk0`.
Careful with this as you can erase your hard drive.
Check `resin util available-drives` for available options.'
parameter: 'drive'
alias: 'd'
}
commandOptions.drive
{
signature: 'config'
description: 'path to the config JSON file, see `resin os build-config`'

View File

@ -174,12 +174,7 @@ exports.buildConfig =
'''
permission: 'user'
options: [
{
signature: 'advanced'
description: 'show advanced commands'
boolean: true
alias: 'v'
}
commandOptions.advancedConfig
{
signature: 'output'
description: 'the path to the output JSON file'
@ -210,12 +205,7 @@ exports.configure =
'''
permission: 'user'
options: [
{
signature: 'advanced'
description: 'show advanced commands'
boolean: true
alias: 'v'
}
commandOptions.advancedConfig
{
signature: 'config'
description: 'path to the config JSON file, see `resin os build-config`'
@ -267,12 +257,7 @@ exports.initialize =
alias: 't'
required: 'You have to specify a device type'
}
{
signature: 'drive'
description: 'drive to write the image to. Check `resin util available-drives` for available options.'
parameter: 'drive'
alias: 'd'
}
commandOptions.drive
]
action: (params, options, done) ->
Promise = require('bluebird')