Implement settings command

This command allows the user to list all detected settings.
This commit is contained in:
Juan Cruz Viotti 2015-11-15 22:08:02 -04:00
parent d079a57da4
commit f52dd2976f
9 changed files with 63 additions and 1 deletions

View File

@ -11,6 +11,7 @@
notes: require('./notes'),
help: require('./help'),
os: require('./os'),
settings: require('./settings'),
config: require('./config')
};

17
build/actions/settings.js Normal file
View File

@ -0,0 +1,17 @@
(function() {
var prettyjson, resin;
resin = require('resin-sdk');
prettyjson = require('prettyjson');
exports.list = {
signature: 'settings',
description: 'print current settings',
help: 'Use this command to display detected settings\n\nExamples:\n\n $ resin settings',
action: function(params, options, done) {
return resin.settings.getAll().then(prettyjson.render).then(console.log).nodeify(done);
}
};
}).call(this);

View File

@ -104,6 +104,8 @@
capitano.command(actions.config.reconfigure);
capitano.command(actions.settings.list);
capitano.command(actions.logs);
update.notify();

View File

@ -68,6 +68,12 @@
"lib/actions/config.coffee"
]
},
{
"title": "Settings",
"files": [
"lib/actions/settings.coffee"
]
},
{
"title": "Wizard",
"files": [

View File

@ -82,6 +82,10 @@ Now you have access to all the commands referenced below.
- [config write <key> <value>](#config-write-60-key-62-60-value-62-)
- [config reconfigure](#config-reconfigure)
- Settings
- [settings](#settings)
- Wizard
- [quickstart [name]](#quickstart-name-)
@ -670,6 +674,16 @@ drive
show advanced commands
# Settings
## settings
Use this command to display detected settings
Examples:
$ resin settings
# Wizard
## quickstart [name]

View File

@ -10,4 +10,5 @@ module.exports =
notes: require('./notes')
help: require('./help')
os: require('./os')
settings: require('./settings')
config: require('./config')

View File

@ -0,0 +1,18 @@
resin = require('resin-sdk')
prettyjson = require('prettyjson')
exports.list =
signature: 'settings'
description: 'print current settings'
help: '''
Use this command to display detected settings
Examples:
$ resin settings
'''
action: (params, options, done) ->
resin.settings.getAll()
.then(prettyjson.render)
.then(console.log)
.nodeify(done)

View File

@ -75,6 +75,9 @@ capitano.command(actions.config.read)
capitano.command(actions.config.write)
capitano.command(actions.config.reconfigure)
# ---------- Settings Module ----------
capitano.command(actions.settings.list)
# ---------- Logs Module ----------
capitano.command(actions.logs)

View File

@ -58,7 +58,7 @@
"resin-image": "^1.1.4",
"resin-image-manager": "^3.2.2",
"resin-pine": "^1.3.0",
"resin-sdk": "^4.1.1",
"resin-sdk": "^4.1.2",
"resin-settings-client": "^3.1.0",
"resin-vcs": "^2.0.0",
"rimraf": "^2.4.3",