From 6a83a537c7f78290457f10575292fcc3e3bdf3a0 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Tue, 3 Mar 2015 10:14:16 -0400 Subject: [PATCH] Implement basic documentation generation mechanism --- build/actions/app.js | 12 +++---- build/actions/auth.js | 8 ++--- build/actions/device.js | 14 ++++---- build/actions/drive.js | 2 +- build/actions/environment-variables.js | 8 ++--- build/actions/examples.js | 6 ++-- build/actions/help.js | 11 +++--- build/actions/info.js | 1 + build/actions/keys.js | 8 ++--- build/actions/logs.js | 2 +- build/actions/notes.js | 2 +- build/actions/os.js | 4 +-- build/actions/plugin.js | 8 ++--- build/actions/preferences.js | 2 +- doc/app/create.md | 21 +++++++++++ doc/app/info.md | 7 ++++ doc/app/init.md | 10 ++++++ doc/app/list.md | 10 ++++++ doc/app/remove.md | 17 +++++++++ doc/app/restart.md | 7 ++++ doc/auth/login.md | 22 ++++++++++++ doc/auth/logout.md | 7 ++++ doc/auth/signup.md | 31 ++++++++++++++++ doc/auth/whoami.md | 7 ++++ doc/device/identify.md | 9 +++++ doc/device/info.md | 7 ++++ doc/device/init.md | 46 ++++++++++++++++++++++++ doc/device/list.md | 13 +++++++ doc/device/remove.md | 17 +++++++++ doc/device/rename.md | 10 ++++++ doc/device/supported.md | 7 ++++ doc/drive/list.md | 7 ++++ doc/environment-variables/add.md | 22 ++++++++++++ doc/environment-variables/list.md | 23 ++++++++++++ doc/environment-variables/remove.md | 19 ++++++++++ doc/environment-variables/rename.md | 7 ++++ doc/examples/clone.md | 10 ++++++ doc/examples/info.md | 7 ++++ doc/examples/list.md | 7 ++++ doc/help/help.md | 8 +++++ doc/info/version.md | 3 ++ doc/keys/add.md | 11 ++++++ doc/keys/info.md | 7 ++++ doc/keys/list.md | 7 ++++ doc/keys/remove.md | 17 +++++++++ doc/notes/set.md | 18 ++++++++++ doc/os/download.md | 37 +++++++++++++++++++ doc/os/install.md | 34 ++++++++++++++++++ doc/plugin/install.md | 9 +++++ doc/plugin/list.md | 7 ++++ doc/plugin/remove.md | 17 +++++++++ doc/plugin/update.md | 9 +++++ doc/preferences/preferences.md | 10 ++++++ extras/capitano-doc/index.coffee | 20 +++++++++++ extras/capitano-doc/markdown.coffee | 23 ++++++++++++ extras/capitano-doc/utils.coffee | 25 +++++++++++++ lib/actions/app.coffee | 7 ++++ lib/actions/auth.coffee | 4 +++ lib/actions/device.coffee | 13 +++++-- lib/actions/drive.coffee | 1 + lib/actions/environment-variables.coffee | 4 +++ lib/actions/examples.coffee | 3 ++ lib/actions/help.coffee | 16 ++++++--- lib/actions/info.coffee | 3 ++ lib/actions/keys.coffee | 4 +++ lib/actions/logs.coffee | 1 + lib/actions/notes.coffee | 1 + lib/actions/os.coffee | 4 +++ lib/actions/plugin.coffee | 4 +++ lib/actions/preferences.coffee | 1 + package.json | 4 ++- scripts/extract-documentation.sh | 18 ++++++++++ 72 files changed, 737 insertions(+), 51 deletions(-) create mode 100644 doc/app/create.md create mode 100644 doc/app/info.md create mode 100644 doc/app/init.md create mode 100644 doc/app/list.md create mode 100644 doc/app/remove.md create mode 100644 doc/app/restart.md create mode 100644 doc/auth/login.md create mode 100644 doc/auth/logout.md create mode 100644 doc/auth/signup.md create mode 100644 doc/auth/whoami.md create mode 100644 doc/device/identify.md create mode 100644 doc/device/info.md create mode 100644 doc/device/init.md create mode 100644 doc/device/list.md create mode 100644 doc/device/remove.md create mode 100644 doc/device/rename.md create mode 100644 doc/device/supported.md create mode 100644 doc/drive/list.md create mode 100644 doc/environment-variables/add.md create mode 100644 doc/environment-variables/list.md create mode 100644 doc/environment-variables/remove.md create mode 100644 doc/environment-variables/rename.md create mode 100644 doc/examples/clone.md create mode 100644 doc/examples/info.md create mode 100644 doc/examples/list.md create mode 100644 doc/help/help.md create mode 100644 doc/info/version.md create mode 100644 doc/keys/add.md create mode 100644 doc/keys/info.md create mode 100644 doc/keys/list.md create mode 100644 doc/keys/remove.md create mode 100644 doc/notes/set.md create mode 100644 doc/os/download.md create mode 100644 doc/os/install.md create mode 100644 doc/plugin/install.md create mode 100644 doc/plugin/list.md create mode 100644 doc/plugin/remove.md create mode 100644 doc/plugin/update.md create mode 100644 doc/preferences/preferences.md create mode 100644 extras/capitano-doc/index.coffee create mode 100644 extras/capitano-doc/markdown.coffee create mode 100644 extras/capitano-doc/utils.coffee create mode 100755 scripts/extract-documentation.sh diff --git a/build/actions/app.js b/build/actions/app.js index ebf3f1d4..35c9d2d9 100644 --- a/build/actions/app.js +++ b/build/actions/app.js @@ -14,7 +14,7 @@ exports.create = { signature: 'app create ', description: 'create an application', - help: 'Use this command to create a new resin.io application.\n\nYou can specify the application type with the `--type` option.\nOtherwise, an interactive dropdown will be shown for you to select from.\n\nYou can see a list of supported device types with\n $ resin devices supported\n\nExamples:\n $ resin app create MyApp\n $ resin app create MyApp --type raspberry-pi', + help: 'Use this command to create a new resin.io application.\n\nYou can specify the application type with the `--type` option.\nOtherwise, an interactive dropdown will be shown for you to select from.\n\nYou can see a list of supported device types with\n\n $ resin devices supported\n\nExamples:\n\n $ resin app create MyApp\n $ resin app create MyApp --type raspberry-pi', options: [ { signature: 'type', @@ -46,7 +46,7 @@ exports.list = { signature: 'apps', description: 'list all applications', - help: 'Use this command to list all your applications.\n\nNotice this command only shows the most important bits of information for each app.\nIf you want detailed information, use resin app instead.\n\nExamples:\n $ resin apps', + help: 'Use this command to list all your applications.\n\nNotice this command only shows the most important bits of information for each app.\nIf you want detailed information, use resin app instead.\n\nExamples:\n\n $ resin apps', permission: 'user', action: function(params, options, done) { return resin.models.application.getAll(function(error, applications) { @@ -62,7 +62,7 @@ exports.info = { signature: 'app ', description: 'list a single application', - help: 'Use this command to show detailed information for a single application.\n\nExamples:\n $ resin app 91', + help: 'Use this command to show detailed information for a single application.\n\nExamples:\n\n $ resin app 91', permission: 'user', action: function(params, options, done) { return resin.models.application.get(params.id, function(error, application) { @@ -78,7 +78,7 @@ exports.restart = { signature: 'app restart ', description: 'restart an application', - help: 'Use this command to restart all devices that belongs to a certain application.\n\nExamples:\n $ resin app restart 91', + help: 'Use this command to restart all devices that belongs to a certain application.\n\nExamples:\n\n $ resin app restart 91', permission: 'user', action: function(params, options, done) { return resin.models.application.restart(params.id, done); @@ -88,7 +88,7 @@ exports.remove = { signature: 'app rm ', description: 'remove an application', - help: 'Use this command to remove a resin.io application.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n $ resin app rm 91\n $ resin app rm 91 --yes', + help: 'Use this command to remove a resin.io application.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n\n $ resin app rm 91\n $ resin app rm 91 --yes', options: [commandOptions.yes], permission: 'user', action: function(params, options, done) { @@ -101,7 +101,7 @@ exports.init = { signature: 'init ', description: 'init an application', - help: 'Use this command to associate a local project to an existing resin.io application.\n\nThe application should be a git repository before issuing this command.\nNotice this command adds a `resin` git remote to your application.\n\nExamples:\n $ cd myApp && resin init 91', + help: 'Use this command to associate a local project to an existing resin.io application.\n\nThe application should be a git repository before issuing this command.\nNotice this command adds a `resin` git remote to your application.\n\nExamples:\n\n $ cd myApp && resin init 91', permission: 'user', action: function(params, options, done) { var currentDirectory; diff --git a/build/actions/auth.js b/build/actions/auth.js index caccee23..328f6500 100644 --- a/build/actions/auth.js +++ b/build/actions/auth.js @@ -14,7 +14,7 @@ exports.login = { signature: 'login', description: 'login to resin.io', - help: 'Use this command to login to your resin.io account.\nYou need to login before you can use most of the commands this tool provides.\n\nYou can pass your credentials as `--username` and `--password` options, or you can omit the\ncredentials, in which case the tool will present you with an interactive login form.\n\nExamples:\n $ resin login --username --password \n $ resin login', + help: 'Use this command to login to your resin.io account.\nYou need to login before you can use most of the commands this tool provides.\n\nYou can pass your credentials as `--username` and `--password` options, or you can omit the\ncredentials, in which case the tool will present you with an interactive login form.\n\nExamples:\n\n $ resin login --username --password \n $ resin login', options: [ { signature: 'username', @@ -56,7 +56,7 @@ exports.logout = { signature: 'logout', description: 'logout from resin.io', - help: 'Use this command to logout from your resin.io account.o\n\nExamples:\n $ resin logout', + help: 'Use this command to logout from your resin.io account.o\n\nExamples:\n\n $ resin logout', permission: 'user', action: function(params, options, done) { return resin.auth.logout(done); @@ -66,7 +66,7 @@ exports.signup = { signature: 'signup', description: 'signup to resin.io', - help: 'Use this command to signup for a resin.io account.\n\nIf signup is successful, you\'ll be logged in to your new user automatically.\n\nExamples:\n $ resin signup\n Email: me@mycompany.com\n Username: johndoe\n Password: ***********\n\n $ resin signup --email me@mycompany.com --username johndoe --password ***********\n\n $ resin whoami\n johndoe', + help: 'Use this command to signup for a resin.io account.\n\nIf signup is successful, you\'ll be logged in to your new user automatically.\n\nExamples:\n\n $ resin signup\n Email: me@mycompany.com\n Username: johndoe\n Password: ***********\n\n $ resin signup --email me@mycompany.com --username johndoe --password ***********\n\n $ resin whoami\n johndoe', options: [ { signature: 'email', @@ -119,7 +119,7 @@ exports.whoami = { signature: 'whoami', description: 'get current username', - help: 'Use this command to find out the current logged in username.\n\nExamples:\n $ resin whoami', + help: 'Use this command to find out the current logged in username.\n\nExamples:\n\n $ resin whoami', permission: 'user', action: function(params, options, done) { return resin.auth.whoami(function(error, username) { diff --git a/build/actions/device.js b/build/actions/device.js index 97abe3dc..730ed31d 100644 --- a/build/actions/device.js +++ b/build/actions/device.js @@ -18,7 +18,7 @@ exports.list = { signature: 'devices', description: 'list all devices', - help: 'Use this command to list all devices that belong to a certain application.\n\nExamples:\n $ resin devices --application 91', + help: 'Use this command to list all devices that belong to a certain application.\n\nExamples:\n\n $ resin devices --application 91', options: [commandOptions.application], permission: 'user', action: function(params, options, done) { @@ -35,7 +35,7 @@ exports.info = { signature: 'device ', description: 'list a single device', - help: 'Use this command to show information about a single device.\n\nExamples:\n $ resin device 317', + help: 'Use this command to show information about a single device.\n\nExamples:\n\n $ resin device 317', permission: 'user', action: function(params, options, done) { return resin.models.device.get(params.id, function(error, device) { @@ -51,7 +51,7 @@ exports.remove = { signature: 'device rm ', description: 'remove a device', - help: 'Use this command to remove a device from resin.io.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n $ resin device rm 317\n $ resin device rm 317 --yes', + help: 'Use this command to remove a device from resin.io.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n\n $ resin device rm 317\n $ resin device rm 317 --yes', options: [commandOptions.yes], permission: 'user', action: function(params, options, done) { @@ -64,7 +64,7 @@ exports.identify = { signature: 'device identify ', description: 'identify a device with a UUID', - help: 'Use this command to identify a device.\n\nIn the Raspberry Pi, the ACT led is blinked several times.\n\nExamples:\n $ resin device identify 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828', + help: 'Use this command to identify a device.\n\nIn the Raspberry Pi, the ACT led is blinked several times.\n\nExamples:\n\n $ resin device identify 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828', permission: 'user', action: function(params, options, done) { return resin.models.device.identify(params.uuid, done); @@ -74,7 +74,7 @@ exports.rename = { signature: 'device rename [name]', description: 'rename a resin device', - help: 'Use this command to rename a device.\n\nIf you omit the name, you\'ll get asked for it interactively.\n\nExamples:\n $ resin device rename 317 MyPi\n $ resin device rename 317', + help: 'Use this command to rename a device.\n\nIf you omit the name, you\'ll get asked for it interactively.\n\nExamples:\n\n $ resin device rename 317 MyPi\n $ resin device rename 317', permission: 'user', action: function(params, options, done) { return async.waterfall([ @@ -93,7 +93,7 @@ exports.supported = { signature: 'devices supported', description: 'list all supported devices', - help: 'Use this command to get the list of all supported devices\n\nExamples:\n $ resin devices supported', + help: 'Use this command to get the list of all supported devices\n\nExamples:\n\n $ resin devices supported', permission: 'user', action: function(params, options, done) { return resin.models.device.getSupportedDeviceTypes(function(error, devices) { @@ -109,7 +109,7 @@ exports.init = { signature: 'device init [device]', description: 'initialise a device with resin os', - help: 'Use this command to download the OS image of a certain application and write it to an SD Card.\n\nNote that this command requires admin privileges.\n\nIf `device` is omitted, you will be prompted to select a device interactively.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nYou can quiet the progress bar by passing the `--quiet` boolean option.\n\nYou may have to unmount the device before attempting this operation.\n\nYou need to configure the network type and other settings:\n\nEthernet:\n You can setup the device OS to use ethernet by setting the `--network` option to "ethernet".\n\nWifi:\n You can setup the device OS to use wifi by setting the `--network` option to "wifi".\n If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well.\n\nExamples:\n $ resin device init --application 91 --network ethernet\n $ resin device init /dev/disk2 --application 91 --network wifi --ssid MyNetwork --key secret', + help: 'Use this command to download the OS image of a certain application and write it to an SD Card.\n\nNote that this command requires admin privileges.\n\nIf `device` is omitted, you will be prompted to select a device interactively.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nYou can quiet the progress bar by passing the `--quiet` boolean option.\n\nYou may have to unmount the device before attempting this operation.\n\nYou need to configure the network type and other settings:\n\nEthernet:\n You can setup the device OS to use ethernet by setting the `--network` option to "ethernet".\n\nWifi:\n You can setup the device OS to use wifi by setting the `--network` option to "wifi".\n If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well.\n\nExamples:\n\n $ resin device init --application 91 --network ethernet\n $ resin device init /dev/disk2 --application 91 --network wifi --ssid MyNetwork --key secret', options: [commandOptions.application, commandOptions.network, commandOptions.wifiSsid, commandOptions.wifiKey], permission: 'user', action: function(params, options, done) { diff --git a/build/actions/drive.js b/build/actions/drive.js index 1cbf7f9b..de1d83ab 100644 --- a/build/actions/drive.js +++ b/build/actions/drive.js @@ -12,7 +12,7 @@ exports.list = { signature: 'drives', description: 'list available drives', - help: 'Use this command to list all drives that are connected to your machine.\n\nExamples:\n $ resin drives', + help: 'Use this command to list all drives that are connected to your machine.\n\nExamples:\n\n $ resin drives', permission: 'user', action: function(params, options, done) { return drivelist.list(function(error, drives) { diff --git a/build/actions/environment-variables.js b/build/actions/environment-variables.js index 98e12e88..ac4dd375 100644 --- a/build/actions/environment-variables.js +++ b/build/actions/environment-variables.js @@ -12,7 +12,7 @@ exports.list = { signature: 'envs', description: 'list all environment variables', - help: 'Use this command to list all environment variables for a particular application.\nNotice we will support per-device environment variables soon.\n\nThis command lists all custom environment variables set on the devices running\nthe application. If you want to see all environment variables, including private\nones used by resin, use the verbose option.\n\nExample:\n $ resin envs --application 91\n $ resin envs --application 91 --verbose', + help: 'Use this command to list all environment variables for a particular application.\nNotice we will support per-device environment variables soon.\n\nThis command lists all custom environment variables set on the devices running\nthe application. If you want to see all environment variables, including private\nones used by resin, use the verbose option.\n\nExample:\n\n $ resin envs --application 91\n $ resin envs --application 91 --verbose', options: [ commandOptions.application, { signature: 'verbose', @@ -39,7 +39,7 @@ exports.remove = { signature: 'env rm ', description: 'remove an environment variable', - help: 'Use this command to remove an environment variable from an application.\n\nDon\'t remove resin specific variables, as things might not work as expected.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n $ resin env rm 215\n $ resin env rm 215 --yes', + help: 'Use this command to remove an environment variable from an application.\n\nDon\'t remove resin specific variables, as things might not work as expected.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n\n $ resin env rm 215\n $ resin env rm 215 --yes', options: [commandOptions.yes], permission: 'user', action: function(params, options, done) { @@ -52,7 +52,7 @@ exports.add = { signature: 'env add [value]', description: 'add an environment variable', - help: 'Use this command to add an enviroment variable to an application.\n\nYou need to pass the `--application` option.\n\nIf value is omitted, the tool will attempt to use the variable\'s value\nas defined in your host machine.\n\nIf the value is grabbed from the environment, a warning message will be printed.\nUse `--quiet` to remove it.\n\nExamples:\n $ resin env add EDITOR vim -a 91\n $ resin env add TERM -a 91', + help: 'Use this command to add an enviroment variable to an application.\n\nYou need to pass the `--application` option.\n\nIf value is omitted, the tool will attempt to use the variable\'s value\nas defined in your host machine.\n\nIf the value is grabbed from the environment, a warning message will be printed.\nUse `--quiet` to remove it.\n\nExamples:\n\n $ resin env add EDITOR vim -a 91\n $ resin env add TERM -a 91', options: [commandOptions.application], permission: 'user', action: function(params, options, done) { @@ -71,7 +71,7 @@ exports.rename = { signature: 'env rename ', description: 'rename an environment variable', - help: 'Use this command to rename an enviroment variable from an application.\n\nExamples:\n $ resin env rename 376 emacs', + help: 'Use this command to rename an enviroment variable from an application.\n\nExamples:\n\n $ resin env rename 376 emacs', permission: 'user', action: function(params, options, done) { return resin.models.environmentVariables.update(params.id, params.value, done); diff --git a/build/actions/examples.js b/build/actions/examples.js index 7704d2a3..3eab4a1f 100644 --- a/build/actions/examples.js +++ b/build/actions/examples.js @@ -20,7 +20,7 @@ exports.list = { signature: 'examples', description: 'list all example applications', - help: 'Use this command to list available example applications from resin.io\n\nExample:\n $ resin examples', + help: 'Use this command to list available example applications from resin.io\n\nExample:\n\n $ resin examples', permission: 'user', action: function() { examplesData = _.map(examplesData, function(example, index) { @@ -40,7 +40,7 @@ exports.info = { signature: 'example ', description: 'list a single example application', - help: 'Use this command to show information of a single example application\n\nExample:\n $ resin example 3', + help: 'Use this command to show information of a single example application\n\nExample:\n\n $ resin example 3', permission: 'user', action: function(params, options, done) { var example, id; @@ -61,7 +61,7 @@ exports.clone = { signature: 'example clone ', description: 'clone an example application', - help: 'Use this command to clone an example application to the current directory\n\nThis command outputs information about the cloning process.\nUse `--quiet` to remove that output.\n\nExample:\n $ resin example clone 3', + help: 'Use this command to clone an example application to the current directory\n\nThis command outputs information about the cloning process.\nUse `--quiet` to remove that output.\n\nExample:\n\n $ resin example clone 3', permission: 'user', action: function(params, options, done) { var example; diff --git a/build/actions/help.js b/build/actions/help.js index 05a168ea..383780a8 100644 --- a/build/actions/help.js +++ b/build/actions/help.js @@ -1,5 +1,5 @@ (function() { - var PADDING_INITIAL, PADDING_MIDDLE, _, addAlias, addOptionPrefix, buildHelpString, buildOptionSignatureHelp, capitano, getCommandHelp, getFieldMaxLength, getOptionHelp, getOptionsParsedSignatures, resin; + var PADDING_INITIAL, PADDING_MIDDLE, _, addAlias, addOptionPrefix, buildHelpString, buildOptionSignatureHelp, capitano, command, general, getCommandHelp, getFieldMaxLength, getOptionHelp, getOptionsParsedSignatures, resin; _ = require('lodash'); @@ -85,7 +85,7 @@ return result; }; - exports.general = function() { + general = function() { var command, i, j, len, len1, option, optionSignatureMaxLength, options, ref; console.log('Usage: resin [COMMAND] [OPTIONS]\n'); console.log('Commands:\n'); @@ -112,7 +112,7 @@ return console.log(); }; - exports.command = function(params, options, done) { + command = function(params, options, done) { return capitano.state.getMatchCommand(params.command, function(error, command) { var i, len, option, optionSignatureMaxLength; if (error != null) { @@ -149,11 +149,12 @@ exports.help = { signature: 'help [command...]', description: 'show help', + help: 'Get detailed help for an specific command.\n\nExamples:\n\n $ resin help apps\n $ resin help os download', action: function(params, options, done) { if (params.command != null) { - return exports.command(params, options, done); + return command(params, options, done); } else { - return exports.general(params, options, done); + return general(params, options, done); } } }; diff --git a/build/actions/info.js b/build/actions/info.js index 4ed6600d..9f9f80b2 100644 --- a/build/actions/info.js +++ b/build/actions/info.js @@ -6,6 +6,7 @@ exports.version = { signature: 'version', description: 'output the version number', + help: 'Display the Resin CLI, as well as the bundled NodeJS version.', action: function() { console.log(packageJSON.name + ": " + packageJSON.version); return console.log("node: " + process.version); diff --git a/build/actions/keys.js b/build/actions/keys.js index eaff5ac9..28ac390e 100644 --- a/build/actions/keys.js +++ b/build/actions/keys.js @@ -20,7 +20,7 @@ exports.list = { signature: 'keys', description: 'list all ssh keys', - help: 'Use this command to list all your SSH keys.\n\nExamples:\n $ resin keys', + help: 'Use this command to list all your SSH keys.\n\nExamples:\n\n $ resin keys', permission: 'user', action: function(params, options, done) { return resin.models.key.getAll(function(error, keys) { @@ -36,7 +36,7 @@ exports.info = { signature: 'key ', description: 'list a single ssh key', - help: 'Use this command to show information about a single SSH key.\n\nExamples:\n $ resin key 17', + help: 'Use this command to show information about a single SSH key.\n\nExamples:\n\n $ resin key 17', permission: 'user', action: function(params, options, done) { return resin.models.key.get(params.id, function(error, key) { @@ -55,7 +55,7 @@ exports.remove = { signature: 'key rm ', description: 'remove a ssh key', - help: 'Use this command to remove a SSH key from resin.io.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n $ resin key rm 17\n $ resin key rm 17 --yes', + help: 'Use this command to remove a SSH key from resin.io.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n\n $ resin key rm 17\n $ resin key rm 17 --yes', options: [commandOptions.yes], permission: 'user', action: function(params, options, done) { @@ -68,7 +68,7 @@ exports.add = { signature: 'key add [path]', description: 'add a SSH key to resin.io', - help: 'Use this command to associate a new SSH key with your account.\n\nIf `path` is omitted, the command will attempt\nto read the SSH key from stdin.\n\nExamples:\n $ resin key add Main ~/.ssh/id_rsa.pub\n $ cat ~/.ssh/id_rsa.pub | resin key add Main', + help: 'Use this command to associate a new SSH key with your account.\n\nIf `path` is omitted, the command will attempt\nto read the SSH key from stdin.\n\nExamples:\n\n $ resin key add Main ~/.ssh/id_rsa.pub\n $ cat ~/.ssh/id_rsa.pub | resin key add Main', permission: 'user', action: function(params, options, done) { return async.waterfall([ diff --git a/build/actions/logs.js b/build/actions/logs.js index f97ff5ec..d6805109 100644 --- a/build/actions/logs.js +++ b/build/actions/logs.js @@ -10,7 +10,7 @@ exports.logs = { signature: 'logs ', description: 'show device logs', - help: 'Use this command to show logs for a specific device.\n\nBy default, the command prints all log messages and exit.\n\nTo limit the output to the n last lines, use the `--num` option along with a number.\nThis is similar to doing `resin logs | tail -n X`.\n\nTo continuously stream output, and see new logs in real time, use the `--tail` option.\n\nNote that for now you need to provide the whole UUID for this command to work correctly,\nand the tool won\'t notice if you\'re using an invalid UUID.\n\nThis is due to some technical limitations that we plan to address soon.\n\nExamples:\n $ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828\n $ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 --num 20\n $ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 --tail', + help: 'Use this command to show logs for a specific device.\n\nBy default, the command prints all log messages and exit.\n\nTo limit the output to the n last lines, use the `--num` option along with a number.\nThis is similar to doing `resin logs | tail -n X`.\n\nTo continuously stream output, and see new logs in real time, use the `--tail` option.\n\nNote that for now you need to provide the whole UUID for this command to work correctly,\nand the tool won\'t notice if you\'re using an invalid UUID.\n\nThis is due to some technical limitations that we plan to address soon.\n\nExamples:\n\n $ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828\n $ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 --num 20\n $ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 --tail', options: [ { signature: 'num', diff --git a/build/actions/notes.js b/build/actions/notes.js index 1b577c96..983e10b0 100644 --- a/build/actions/notes.js +++ b/build/actions/notes.js @@ -8,7 +8,7 @@ exports.set = { signature: 'note <|note>', description: 'set a device note', - help: 'Use this command to set or update a device note.\n\nIf note command isn\'t passed, the tool attempts to read from `stdin`.\n\nTo view the notes, use $ resin device .\n\nExamples:\n $ resin note "My useful note" --device 317\n $ cat note.txt | resin note --device 317', + help: 'Use this command to set or update a device note.\n\nIf note command isn\'t passed, the tool attempts to read from `stdin`.\n\nTo view the notes, use $ resin device .\n\nExamples:\n\n $ resin note "My useful note" --device 317\n $ cat note.txt | resin note --device 317', options: [ { signature: 'device', diff --git a/build/actions/os.js b/build/actions/os.js index 15d065f8..e8ed6559 100644 --- a/build/actions/os.js +++ b/build/actions/os.js @@ -26,7 +26,7 @@ exports.download = { signature: 'os download ', description: 'download device OS', - help: 'Use this command to download the device OS configured to a specific network.\n\nEthernet:\n You can setup the device OS to use ethernet by setting the `--network` option to "ethernet".\n\nWifi:\n You can setup the device OS to use wifi by setting the `--network` option to "wifi".\n If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well.\n\nBy default, this command saved the downloaded image into a resin specific directory.\nYou can save it to a custom location by specifying the `--output` option.\n\nExamples:\n $ resin os download 91 --network ethernet\n $ resin os download 91 --network wifi --ssid MyNetwork --key secreykey123\n $ resin os download 91 --network ethernet --output ~/MyResinOS.zip', + help: 'Use this command to download the device OS configured to a specific network.\n\nEthernet:\n You can setup the device OS to use ethernet by setting the `--network` option to "ethernet".\n\nWifi:\n You can setup the device OS to use wifi by setting the `--network` option to "wifi".\n If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well.\n\nBy default, this command saved the downloaded image into a resin specific directory.\nYou can save it to a custom location by specifying the `--output` option.\n\nExamples:\n\n $ resin os download 91 --network ethernet\n $ resin os download 91 --network wifi --ssid MyNetwork --key secreykey123\n $ resin os download 91 --network ethernet --output ~/MyResinOS.zip', options: [ commandOptions.network, commandOptions.wifiSsid, commandOptions.wifiKey, { signature: 'output', @@ -72,7 +72,7 @@ exports.install = { signature: 'os install [device]', description: 'write an operating system image to a device', - help: 'Use this command to write an operating system image to a device.\n\nNote that this command requires admin privileges.\n\nIf `device` is omitted, you will be prompted to select a device interactively.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nYou can quiet the progress bar by passing the `--quiet` boolean option.\n\nYou may have to unmount the device before attempting this operation.\n\nSee the `drives` command to get a list of all connected devices to your machine and their respective ids.\n\nIn Mac OS X:\n $ sudo diskutil unmountDisk /dev/xxx\n\nIn GNU/Linux:\n $ sudo umount /dev/xxx\n\nExamples:\n $ resin os install rpi.iso /dev/disk2', + help: 'Use this command to write an operating system image to a device.\n\nNote that this command requires admin privileges.\n\nIf `device` is omitted, you will be prompted to select a device interactively.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nYou can quiet the progress bar by passing the `--quiet` boolean option.\n\nYou may have to unmount the device before attempting this operation.\n\nSee the `drives` command to get a list of all connected devices to your machine and their respective ids.\n\nIn Mac OS X:\n\n $ sudo diskutil unmountDisk /dev/xxx\n\nIn GNU/Linux:\n\n $ sudo umount /dev/xxx\n\nExamples:\n\n $ resin os install rpi.iso /dev/disk2', options: [commandOptions.yes], permission: 'user', action: function(params, options, done) { diff --git a/build/actions/plugin.js b/build/actions/plugin.js index 211cb9e0..911dd834 100644 --- a/build/actions/plugin.js +++ b/build/actions/plugin.js @@ -12,7 +12,7 @@ exports.list = { signature: 'plugins', description: 'list all plugins', - help: 'Use this command to list all the installed resin plugins.\n\nExamples:\n $ resin plugins', + help: 'Use this command to list all the installed resin plugins.\n\nExamples:\n\n $ resin plugins', permission: 'user', action: function(params, options, done) { return plugins.list(function(error, resinPlugins) { @@ -32,7 +32,7 @@ exports.install = { signature: 'plugin install ', description: 'install a plugin', - help: 'Use this command to install a resin plugin\n\nUse `--quiet` to prevent information logging.\n\nExamples:\n $ resin plugin install hello', + help: 'Use this command to install a resin plugin\n\nUse `--quiet` to prevent information logging.\n\nExamples:\n\n $ resin plugin install hello', permission: 'user', action: function(params, options, done) { return plugins.install(params.name, function(error) { @@ -48,7 +48,7 @@ exports.update = { signature: 'plugin update ', description: 'update a plugin', - help: 'Use this command to update a resin plugin\n\nUse `--quiet` to prevent information logging.\n\nExamples:\n $ resin plugin update hello', + help: 'Use this command to update a resin plugin\n\nUse `--quiet` to prevent information logging.\n\nExamples:\n\n $ resin plugin update hello', permission: 'user', action: function(params, options, done) { return plugins.update(params.name, function(error, version) { @@ -64,7 +64,7 @@ exports.remove = { signature: 'plugin rm ', description: 'remove a plugin', - help: 'Use this command to remove a resin.io plugin.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n $ resin plugin rm hello\n $ resin plugin rm hello --yes', + help: 'Use this command to remove a resin.io plugin.\n\nNotice this command asks for confirmation interactively.\nYou can avoid this by passing the `--yes` boolean option.\n\nExamples:\n\n $ resin plugin rm hello\n $ resin plugin rm hello --yes', options: [commandOptions.yes], permission: 'user', action: function(params, options, done) { diff --git a/build/actions/preferences.js b/build/actions/preferences.js index 38dbb5a5..8cc5279f 100644 --- a/build/actions/preferences.js +++ b/build/actions/preferences.js @@ -10,7 +10,7 @@ exports.preferences = { signature: 'preferences', description: 'open preferences form', - help: 'Use this command to open the preferences form.\n\nIn the future, we will allow changing all preferences directly from the terminal.\nFor now, we open your default web browser and point it to the web based preferences form.\n\nExamples:\n $ resin preferences', + help: 'Use this command to open the preferences form.\n\nIn the future, we will allow changing all preferences directly from the terminal.\nFor now, we open your default web browser and point it to the web based preferences form.\n\nExamples:\n\n $ resin preferences', permission: 'user', action: function() { var absUrl, preferencesUrl; diff --git a/doc/app/create.md b/doc/app/create.md new file mode 100644 index 00000000..693fe90e --- /dev/null +++ b/doc/app/create.md @@ -0,0 +1,21 @@ +# app create + +Use this command to create a new resin.io application. + +You can specify the application type with the `--type` option. +Otherwise, an interactive dropdown will be shown for you to select from. + +You can see a list of supported device types with + + $ resin devices supported + +Examples: + + $ resin app create MyApp + $ resin app create MyApp --type raspberry-pi + +## Options + +### --type, -t + +application type \ No newline at end of file diff --git a/doc/app/info.md b/doc/app/info.md new file mode 100644 index 00000000..5239e4ec --- /dev/null +++ b/doc/app/info.md @@ -0,0 +1,7 @@ +# app + +Use this command to show detailed information for a single application. + +Examples: + + $ resin app 91 diff --git a/doc/app/init.md b/doc/app/init.md new file mode 100644 index 00000000..47ed51f8 --- /dev/null +++ b/doc/app/init.md @@ -0,0 +1,10 @@ +# init + +Use this command to associate a local project to an existing resin.io application. + +The application should be a git repository before issuing this command. +Notice this command adds a `resin` git remote to your application. + +Examples: + + $ cd myApp && resin init 91 diff --git a/doc/app/list.md b/doc/app/list.md new file mode 100644 index 00000000..5c8811ef --- /dev/null +++ b/doc/app/list.md @@ -0,0 +1,10 @@ +# apps + +Use this command to list all your applications. + +Notice this command only shows the most important bits of information for each app. +If you want detailed information, use resin app instead. + +Examples: + + $ resin apps diff --git a/doc/app/remove.md b/doc/app/remove.md new file mode 100644 index 00000000..9f494e42 --- /dev/null +++ b/doc/app/remove.md @@ -0,0 +1,17 @@ +# app rm + +Use this command to remove a resin.io application. + +Notice this command asks for confirmation interactively. +You can avoid this by passing the `--yes` boolean option. + +Examples: + + $ resin app rm 91 + $ resin app rm 91 --yes + +## Options + +### --yes, -y + +confirm non interactively \ No newline at end of file diff --git a/doc/app/restart.md b/doc/app/restart.md new file mode 100644 index 00000000..ce0da7cd --- /dev/null +++ b/doc/app/restart.md @@ -0,0 +1,7 @@ +# app restart + +Use this command to restart all devices that belongs to a certain application. + +Examples: + + $ resin app restart 91 diff --git a/doc/auth/login.md b/doc/auth/login.md new file mode 100644 index 00000000..19c86312 --- /dev/null +++ b/doc/auth/login.md @@ -0,0 +1,22 @@ +# login + +Use this command to login to your resin.io account. +You need to login before you can use most of the commands this tool provides. + +You can pass your credentials as `--username` and `--password` options, or you can omit the +credentials, in which case the tool will present you with an interactive login form. + +Examples: + + $ resin login --username --password + $ resin login + +## Options + +### --username, -u + +user name + +### --password, -p + +user password \ No newline at end of file diff --git a/doc/auth/logout.md b/doc/auth/logout.md new file mode 100644 index 00000000..2b7ffc12 --- /dev/null +++ b/doc/auth/logout.md @@ -0,0 +1,7 @@ +# logout + +Use this command to logout from your resin.io account.o + +Examples: + + $ resin logout diff --git a/doc/auth/signup.md b/doc/auth/signup.md new file mode 100644 index 00000000..b01a7597 --- /dev/null +++ b/doc/auth/signup.md @@ -0,0 +1,31 @@ +# signup + +Use this command to signup for a resin.io account. + +If signup is successful, you'll be logged in to your new user automatically. + +Examples: + + $ resin signup + Email: me@mycompany.com + Username: johndoe + Password: *********** + + $ resin signup --email me@mycompany.com --username johndoe --password *********** + + $ resin whoami + johndoe + +## Options + +### --email, -e + +user email + +### --username, -u + +user name + +### --password, -p + +user password \ No newline at end of file diff --git a/doc/auth/whoami.md b/doc/auth/whoami.md new file mode 100644 index 00000000..9151a9e5 --- /dev/null +++ b/doc/auth/whoami.md @@ -0,0 +1,7 @@ +# whoami + +Use this command to find out the current logged in username. + +Examples: + + $ resin whoami diff --git a/doc/device/identify.md b/doc/device/identify.md new file mode 100644 index 00000000..e9097f8f --- /dev/null +++ b/doc/device/identify.md @@ -0,0 +1,9 @@ +# device identify + +Use this command to identify a device. + +In the Raspberry Pi, the ACT led is blinked several times. + +Examples: + + $ resin device identify 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 diff --git a/doc/device/info.md b/doc/device/info.md new file mode 100644 index 00000000..b72ddccc --- /dev/null +++ b/doc/device/info.md @@ -0,0 +1,7 @@ +# device + +Use this command to show information about a single device. + +Examples: + + $ resin device 317 diff --git a/doc/device/init.md b/doc/device/init.md new file mode 100644 index 00000000..62f97a30 --- /dev/null +++ b/doc/device/init.md @@ -0,0 +1,46 @@ +# device init [device] + +Use this command to download the OS image of a certain application and write it to an SD Card. + +Note that this command requires admin privileges. + +If `device` is omitted, you will be prompted to select a device interactively. + +Notice this command asks for confirmation interactively. +You can avoid this by passing the `--yes` boolean option. + +You can quiet the progress bar by passing the `--quiet` boolean option. + +You may have to unmount the device before attempting this operation. + +You need to configure the network type and other settings: + +Ethernet: + You can setup the device OS to use ethernet by setting the `--network` option to "ethernet". + +Wifi: + You can setup the device OS to use wifi by setting the `--network` option to "wifi". + If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well. + +Examples: + + $ resin device init --application 91 --network ethernet + $ resin device init /dev/disk2 --application 91 --network wifi --ssid MyNetwork --key secret + +## Options + +### --application, --a,app, --a,app + +application id + +### --network, -n + +network type + +### --ssid, -s + +wifi ssid, if network is wifi + +### --key, -k + +wifi key, if network is wifi \ No newline at end of file diff --git a/doc/device/list.md b/doc/device/list.md new file mode 100644 index 00000000..c14c58bb --- /dev/null +++ b/doc/device/list.md @@ -0,0 +1,13 @@ +# devices + +Use this command to list all devices that belong to a certain application. + +Examples: + + $ resin devices --application 91 + +## Options + +### --application, --a,app, --a,app + +application id \ No newline at end of file diff --git a/doc/device/remove.md b/doc/device/remove.md new file mode 100644 index 00000000..2c94e44c --- /dev/null +++ b/doc/device/remove.md @@ -0,0 +1,17 @@ +# device rm + +Use this command to remove a device from resin.io. + +Notice this command asks for confirmation interactively. +You can avoid this by passing the `--yes` boolean option. + +Examples: + + $ resin device rm 317 + $ resin device rm 317 --yes + +## Options + +### --yes, -y + +confirm non interactively \ No newline at end of file diff --git a/doc/device/rename.md b/doc/device/rename.md new file mode 100644 index 00000000..e0c70d40 --- /dev/null +++ b/doc/device/rename.md @@ -0,0 +1,10 @@ +# device rename [name] + +Use this command to rename a device. + +If you omit the name, you'll get asked for it interactively. + +Examples: + + $ resin device rename 317 MyPi + $ resin device rename 317 diff --git a/doc/device/supported.md b/doc/device/supported.md new file mode 100644 index 00000000..dc867a6d --- /dev/null +++ b/doc/device/supported.md @@ -0,0 +1,7 @@ +# devices supported + +Use this command to get the list of all supported devices + +Examples: + + $ resin devices supported diff --git a/doc/drive/list.md b/doc/drive/list.md new file mode 100644 index 00000000..a52faee0 --- /dev/null +++ b/doc/drive/list.md @@ -0,0 +1,7 @@ +# drives + +Use this command to list all drives that are connected to your machine. + +Examples: + + $ resin drives diff --git a/doc/environment-variables/add.md b/doc/environment-variables/add.md new file mode 100644 index 00000000..5fd77401 --- /dev/null +++ b/doc/environment-variables/add.md @@ -0,0 +1,22 @@ +# env add [value] + +Use this command to add an enviroment variable to an application. + +You need to pass the `--application` option. + +If value is omitted, the tool will attempt to use the variable's value +as defined in your host machine. + +If the value is grabbed from the environment, a warning message will be printed. +Use `--quiet` to remove it. + +Examples: + + $ resin env add EDITOR vim -a 91 + $ resin env add TERM -a 91 + +## Options + +### --application, --a,app, --a,app + +application id \ No newline at end of file diff --git a/doc/environment-variables/list.md b/doc/environment-variables/list.md new file mode 100644 index 00000000..9a124a90 --- /dev/null +++ b/doc/environment-variables/list.md @@ -0,0 +1,23 @@ +# envs + +Use this command to list all environment variables for a particular application. +Notice we will support per-device environment variables soon. + +This command lists all custom environment variables set on the devices running +the application. If you want to see all environment variables, including private +ones used by resin, use the verbose option. + +Example: + + $ resin envs --application 91 + $ resin envs --application 91 --verbose + +## Options + +### --application, --a,app, --a,app + +application id + +### --verbose, -v + +show private environment variables \ No newline at end of file diff --git a/doc/environment-variables/remove.md b/doc/environment-variables/remove.md new file mode 100644 index 00000000..3ab06f29 --- /dev/null +++ b/doc/environment-variables/remove.md @@ -0,0 +1,19 @@ +# env rm + +Use this command to remove an environment variable from an application. + +Don't remove resin specific variables, as things might not work as expected. + +Notice this command asks for confirmation interactively. +You can avoid this by passing the `--yes` boolean option. + +Examples: + + $ resin env rm 215 + $ resin env rm 215 --yes + +## Options + +### --yes, -y + +confirm non interactively \ No newline at end of file diff --git a/doc/environment-variables/rename.md b/doc/environment-variables/rename.md new file mode 100644 index 00000000..02efe476 --- /dev/null +++ b/doc/environment-variables/rename.md @@ -0,0 +1,7 @@ +# env rename + +Use this command to rename an enviroment variable from an application. + +Examples: + + $ resin env rename 376 emacs diff --git a/doc/examples/clone.md b/doc/examples/clone.md new file mode 100644 index 00000000..e8c5fd3e --- /dev/null +++ b/doc/examples/clone.md @@ -0,0 +1,10 @@ +# example clone + +Use this command to clone an example application to the current directory + +This command outputs information about the cloning process. +Use `--quiet` to remove that output. + +Example: + + $ resin example clone 3 diff --git a/doc/examples/info.md b/doc/examples/info.md new file mode 100644 index 00000000..794ac214 --- /dev/null +++ b/doc/examples/info.md @@ -0,0 +1,7 @@ +# example + +Use this command to show information of a single example application + +Example: + + $ resin example 3 diff --git a/doc/examples/list.md b/doc/examples/list.md new file mode 100644 index 00000000..df82088c --- /dev/null +++ b/doc/examples/list.md @@ -0,0 +1,7 @@ +# examples + +Use this command to list available example applications from resin.io + +Example: + + $ resin examples diff --git a/doc/help/help.md b/doc/help/help.md new file mode 100644 index 00000000..475f0b79 --- /dev/null +++ b/doc/help/help.md @@ -0,0 +1,8 @@ +# help [command...] + +Get detailed help for an specific command. + +Examples: + + $ resin help apps + $ resin help os download diff --git a/doc/info/version.md b/doc/info/version.md new file mode 100644 index 00000000..028bc186 --- /dev/null +++ b/doc/info/version.md @@ -0,0 +1,3 @@ +# version + +Display the Resin CLI, as well as the bundled NodeJS version. diff --git a/doc/keys/add.md b/doc/keys/add.md new file mode 100644 index 00000000..0280f500 --- /dev/null +++ b/doc/keys/add.md @@ -0,0 +1,11 @@ +# key add [path] + +Use this command to associate a new SSH key with your account. + +If `path` is omitted, the command will attempt +to read the SSH key from stdin. + +Examples: + + $ resin key add Main ~/.ssh/id_rsa.pub + $ cat ~/.ssh/id_rsa.pub | resin key add Main diff --git a/doc/keys/info.md b/doc/keys/info.md new file mode 100644 index 00000000..acbfe1d9 --- /dev/null +++ b/doc/keys/info.md @@ -0,0 +1,7 @@ +# key + +Use this command to show information about a single SSH key. + +Examples: + + $ resin key 17 diff --git a/doc/keys/list.md b/doc/keys/list.md new file mode 100644 index 00000000..4217e316 --- /dev/null +++ b/doc/keys/list.md @@ -0,0 +1,7 @@ +# keys + +Use this command to list all your SSH keys. + +Examples: + + $ resin keys diff --git a/doc/keys/remove.md b/doc/keys/remove.md new file mode 100644 index 00000000..992465e1 --- /dev/null +++ b/doc/keys/remove.md @@ -0,0 +1,17 @@ +# key rm + +Use this command to remove a SSH key from resin.io. + +Notice this command asks for confirmation interactively. +You can avoid this by passing the `--yes` boolean option. + +Examples: + + $ resin key rm 17 + $ resin key rm 17 --yes + +## Options + +### --yes, -y + +confirm non interactively \ No newline at end of file diff --git a/doc/notes/set.md b/doc/notes/set.md new file mode 100644 index 00000000..5f58104f --- /dev/null +++ b/doc/notes/set.md @@ -0,0 +1,18 @@ +# note <|note> + +Use this command to set or update a device note. + +If note command isn't passed, the tool attempts to read from `stdin`. + +To view the notes, use $ resin device . + +Examples: + + $ resin note "My useful note" --device 317 + $ cat note.txt | resin note --device 317 + +## Options + +### --device, --d,dev, --d,dev + +device id \ No newline at end of file diff --git a/doc/os/download.md b/doc/os/download.md new file mode 100644 index 00000000..cc4c3ff6 --- /dev/null +++ b/doc/os/download.md @@ -0,0 +1,37 @@ +# os download + +Use this command to download the device OS configured to a specific network. + +Ethernet: + You can setup the device OS to use ethernet by setting the `--network` option to "ethernet". + +Wifi: + You can setup the device OS to use wifi by setting the `--network` option to "wifi". + If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well. + +By default, this command saved the downloaded image into a resin specific directory. +You can save it to a custom location by specifying the `--output` option. + +Examples: + + $ resin os download 91 --network ethernet + $ resin os download 91 --network wifi --ssid MyNetwork --key secreykey123 + $ resin os download 91 --network ethernet --output ~/MyResinOS.zip + +## Options + +### --network, -n + +network type + +### --ssid, -s + +wifi ssid, if network is wifi + +### --key, -k + +wifi key, if network is wifi + +### --output, -o + +output file \ No newline at end of file diff --git a/doc/os/install.md b/doc/os/install.md new file mode 100644 index 00000000..ce227da0 --- /dev/null +++ b/doc/os/install.md @@ -0,0 +1,34 @@ +# os install [device] + +Use this command to write an operating system image to a device. + +Note that this command requires admin privileges. + +If `device` is omitted, you will be prompted to select a device interactively. + +Notice this command asks for confirmation interactively. +You can avoid this by passing the `--yes` boolean option. + +You can quiet the progress bar by passing the `--quiet` boolean option. + +You may have to unmount the device before attempting this operation. + +See the `drives` command to get a list of all connected devices to your machine and their respective ids. + +In Mac OS X: + + $ sudo diskutil unmountDisk /dev/xxx + +In GNU/Linux: + + $ sudo umount /dev/xxx + +Examples: + + $ resin os install rpi.iso /dev/disk2 + +## Options + +### --yes, -y + +confirm non interactively \ No newline at end of file diff --git a/doc/plugin/install.md b/doc/plugin/install.md new file mode 100644 index 00000000..619b0ee1 --- /dev/null +++ b/doc/plugin/install.md @@ -0,0 +1,9 @@ +# plugin install + +Use this command to install a resin plugin + +Use `--quiet` to prevent information logging. + +Examples: + + $ resin plugin install hello diff --git a/doc/plugin/list.md b/doc/plugin/list.md new file mode 100644 index 00000000..9c7cc9f9 --- /dev/null +++ b/doc/plugin/list.md @@ -0,0 +1,7 @@ +# plugins + +Use this command to list all the installed resin plugins. + +Examples: + + $ resin plugins diff --git a/doc/plugin/remove.md b/doc/plugin/remove.md new file mode 100644 index 00000000..61675919 --- /dev/null +++ b/doc/plugin/remove.md @@ -0,0 +1,17 @@ +# plugin rm + +Use this command to remove a resin.io plugin. + +Notice this command asks for confirmation interactively. +You can avoid this by passing the `--yes` boolean option. + +Examples: + + $ resin plugin rm hello + $ resin plugin rm hello --yes + +## Options + +### --yes, -y + +confirm non interactively \ No newline at end of file diff --git a/doc/plugin/update.md b/doc/plugin/update.md new file mode 100644 index 00000000..ba9d89d9 --- /dev/null +++ b/doc/plugin/update.md @@ -0,0 +1,9 @@ +# plugin update + +Use this command to update a resin plugin + +Use `--quiet` to prevent information logging. + +Examples: + + $ resin plugin update hello diff --git a/doc/preferences/preferences.md b/doc/preferences/preferences.md new file mode 100644 index 00000000..c4a8c805 --- /dev/null +++ b/doc/preferences/preferences.md @@ -0,0 +1,10 @@ +# preferences + +Use this command to open the preferences form. + +In the future, we will allow changing all preferences directly from the terminal. +For now, we open your default web browser and point it to the web based preferences form. + +Examples: + + $ resin preferences diff --git a/extras/capitano-doc/index.coffee b/extras/capitano-doc/index.coffee new file mode 100644 index 00000000..2d4e44d7 --- /dev/null +++ b/extras/capitano-doc/index.coffee @@ -0,0 +1,20 @@ +mkdirp = require('mkdirp') +fs = require('fs') +path = require('path') +capitano = require('capitano') +markdown = require('./markdown') + +capitano.command + signature: 'markdown ' + description: 'file to markdown' + action: (params, options, done) -> + mkdirp.sync(params.output) + action = require(params.file) + + for actionName, actionCommand of action + output = path.join(params.output, "#{actionName}.md") + fs.writeFileSync(output, markdown.command(actionCommand)) + + return done() + +capitano.run(process.argv) diff --git a/extras/capitano-doc/markdown.coffee b/extras/capitano-doc/markdown.coffee new file mode 100644 index 00000000..1b724f94 --- /dev/null +++ b/extras/capitano-doc/markdown.coffee @@ -0,0 +1,23 @@ +_ = require('lodash') +utils = require('./utils') + +exports.option = (option) -> + result = utils.parseSignature(option) + +exports.command = (command) -> + result = """ + # #{command.signature} + + #{command.help}\n + """ + + if not _.isEmpty(command.options) + result += '\n## Options' + + for option in command.options + result += """ + \n\n### #{utils.parseSignature(option)} + + #{option.description} + """ + return result diff --git a/extras/capitano-doc/utils.coffee b/extras/capitano-doc/utils.coffee new file mode 100644 index 00000000..b0b9bd49 --- /dev/null +++ b/extras/capitano-doc/utils.coffee @@ -0,0 +1,25 @@ +_ = require('lodash') + +exports.getOptionPrefix = (signature) -> + if signature.length > 1 + return '--' + else + return '-' + +exports.getOptionSignature = (signature) -> + return "#{exports.getOptionPrefix(signature)}#{signature}" + +exports.parseSignature = (option) -> + result = exports.getOptionSignature(option.signature) + + if not _.isEmpty(option.alias) + if _.isString(option.alias) + result += ", #{exports.getOptionSignature(option.alias)}" + else + for alias in option.alias + result += ", #{exports.getOptionSignature(option.alias)}" + + if option.parameter? + result += " <#{option.parameter}>" + + return result diff --git a/lib/actions/app.coffee b/lib/actions/app.coffee index b21ada86..747a34db 100644 --- a/lib/actions/app.coffee +++ b/lib/actions/app.coffee @@ -14,9 +14,11 @@ exports.create = Otherwise, an interactive dropdown will be shown for you to select from. You can see a list of supported device types with + $ resin devices supported Examples: + $ resin app create MyApp $ resin app create MyApp --type raspberry-pi ''' @@ -54,6 +56,7 @@ exports.list = If you want detailed information, use resin app instead. Examples: + $ resin apps ''' permission: 'user' @@ -76,6 +79,7 @@ exports.info = Use this command to show detailed information for a single application. Examples: + $ resin app 91 ''' permission: 'user' @@ -98,6 +102,7 @@ exports.restart = Use this command to restart all devices that belongs to a certain application. Examples: + $ resin app restart 91 ''' permission: 'user' @@ -114,6 +119,7 @@ exports.remove = You can avoid this by passing the `--yes` boolean option. Examples: + $ resin app rm 91 $ resin app rm 91 --yes ''' @@ -134,6 +140,7 @@ exports.init = Notice this command adds a `resin` git remote to your application. Examples: + $ cd myApp && resin init 91 ''' permission: 'user' diff --git a/lib/actions/auth.coffee b/lib/actions/auth.coffee index 42da00ec..d0ce92f8 100644 --- a/lib/actions/auth.coffee +++ b/lib/actions/auth.coffee @@ -15,6 +15,7 @@ exports.login = credentials, in which case the tool will present you with an interactive login form. Examples: + $ resin login --username --password $ resin login ''' @@ -64,6 +65,7 @@ exports.logout = Use this command to logout from your resin.io account.o Examples: + $ resin logout ''' permission: 'user' @@ -79,6 +81,7 @@ exports.signup = If signup is successful, you'll be logged in to your new user automatically. Examples: + $ resin signup Email: me@mycompany.com Username: johndoe @@ -146,6 +149,7 @@ exports.whoami = Use this command to find out the current logged in username. Examples: + $ resin whoami ''' permission: 'user' diff --git a/lib/actions/device.coffee b/lib/actions/device.coffee index ae446abc..2ba29cdf 100644 --- a/lib/actions/device.coffee +++ b/lib/actions/device.coffee @@ -13,6 +13,7 @@ exports.list = Use this command to list all devices that belong to a certain application. Examples: + $ resin devices --application 91 ''' options: [ commandOptions.application ] @@ -39,6 +40,7 @@ exports.info = Use this command to show information about a single device. Examples: + $ resin device 317 ''' permission: 'user' @@ -73,6 +75,7 @@ exports.remove = You can avoid this by passing the `--yes` boolean option. Examples: + $ resin device rm 317 $ resin device rm 317 --yes ''' @@ -92,6 +95,7 @@ exports.identify = In the Raspberry Pi, the ACT led is blinked several times. Examples: + $ resin device identify 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 ''' permission: 'user' @@ -107,6 +111,7 @@ exports.rename = If you omit the name, you'll get asked for it interactively. Examples: + $ resin device rename 317 MyPi $ resin device rename 317 ''' @@ -131,6 +136,7 @@ exports.supported = Use this command to get the list of all supported devices Examples: + $ resin devices supported ''' permission: 'user' @@ -160,13 +166,14 @@ exports.init = You need to configure the network type and other settings: Ethernet: - You can setup the device OS to use ethernet by setting the `--network` option to "ethernet". + You can setup the device OS to use ethernet by setting the `--network` option to "ethernet". Wifi: - You can setup the device OS to use wifi by setting the `--network` option to "wifi". - If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well. + You can setup the device OS to use wifi by setting the `--network` option to "wifi". + If you set "network" to "wifi", you will need to specify the `--ssid` and `--key` option as well. Examples: + $ resin device init --application 91 --network ethernet $ resin device init /dev/disk2 --application 91 --network wifi --ssid MyNetwork --key secret ''' diff --git a/lib/actions/drive.coffee b/lib/actions/drive.coffee index 6918b376..cc80b035 100644 --- a/lib/actions/drive.coffee +++ b/lib/actions/drive.coffee @@ -10,6 +10,7 @@ exports.list = Use this command to list all drives that are connected to your machine. Examples: + $ resin drives ''' permission: 'user' diff --git a/lib/actions/environment-variables.coffee b/lib/actions/environment-variables.coffee index bb6d2ceb..45d639c6 100644 --- a/lib/actions/environment-variables.coffee +++ b/lib/actions/environment-variables.coffee @@ -15,6 +15,7 @@ exports.list = ones used by resin, use the verbose option. Example: + $ resin envs --application 91 $ resin envs --application 91 --verbose ''' @@ -56,6 +57,7 @@ exports.remove = You can avoid this by passing the `--yes` boolean option. Examples: + $ resin env rm 215 $ resin env rm 215 --yes ''' @@ -81,6 +83,7 @@ exports.add = Use `--quiet` to remove it. Examples: + $ resin env add EDITOR vim -a 91 $ resin env add TERM -a 91 ''' @@ -104,6 +107,7 @@ exports.rename = Use this command to rename an enviroment variable from an application. Examples: + $ resin env rename 376 emacs ''' permission: 'user' diff --git a/lib/actions/examples.coffee b/lib/actions/examples.coffee index 07c9d338..4be07db8 100644 --- a/lib/actions/examples.coffee +++ b/lib/actions/examples.coffee @@ -14,6 +14,7 @@ exports.list = Use this command to list available example applications from resin.io Example: + $ resin examples ''' permission: 'user' @@ -40,6 +41,7 @@ exports.info = Use this command to show information of a single example application Example: + $ resin example 3 ''' permission: 'user' @@ -73,6 +75,7 @@ exports.clone = Use `--quiet` to remove that output. Example: + $ resin example clone 3 ''' permission: 'user' diff --git a/lib/actions/help.coffee b/lib/actions/help.coffee index 88579245..c69c5af6 100644 --- a/lib/actions/help.coffee +++ b/lib/actions/help.coffee @@ -60,7 +60,7 @@ getOptionHelp = (option, maxLength) -> result += option.description return result -exports.general = -> +general = -> console.log('Usage: resin [COMMAND] [OPTIONS]\n') console.log('Commands:\n') @@ -82,7 +82,7 @@ exports.general = -> console.log() -exports.command = (params, options, done) -> +command = (params, options, done) -> capitano.state.getMatchCommand params.command, (error, command) -> return done(error) if error? @@ -116,8 +116,16 @@ exports.command = (params, options, done) -> exports.help = signature: 'help [command...]' description: 'show help' + help: ''' + Get detailed help for an specific command. + + Examples: + + $ resin help apps + $ resin help os download + ''' action: (params, options, done) -> if params.command? - exports.command(params, options, done) + command(params, options, done) else - exports.general(params, options, done) + general(params, options, done) diff --git a/lib/actions/info.coffee b/lib/actions/info.coffee index 45803f4c..47230ae8 100644 --- a/lib/actions/info.coffee +++ b/lib/actions/info.coffee @@ -3,6 +3,9 @@ packageJSON = require('../../package.json') exports.version = signature: 'version' description: 'output the version number' + help: ''' + Display the Resin CLI, as well as the bundled NodeJS version. + ''' action: -> console.log("#{packageJSON.name}: #{packageJSON.version}") console.log("node: #{process.version}") diff --git a/lib/actions/keys.coffee b/lib/actions/keys.coffee index 37c8ad69..12bdb09a 100644 --- a/lib/actions/keys.coffee +++ b/lib/actions/keys.coffee @@ -14,6 +14,7 @@ exports.list = Use this command to list all your SSH keys. Examples: + $ resin keys ''' permission: 'user' @@ -30,6 +31,7 @@ exports.info = Use this command to show information about a single SSH key. Examples: + $ resin key 17 ''' permission: 'user' @@ -53,6 +55,7 @@ exports.remove = You can avoid this by passing the `--yes` boolean option. Examples: + $ resin key rm 17 $ resin key rm 17 --yes ''' @@ -73,6 +76,7 @@ exports.add = to read the SSH key from stdin. Examples: + $ resin key add Main ~/.ssh/id_rsa.pub $ cat ~/.ssh/id_rsa.pub | resin key add Main ''' diff --git a/lib/actions/logs.coffee b/lib/actions/logs.coffee index a7a28aae..985d499b 100644 --- a/lib/actions/logs.coffee +++ b/lib/actions/logs.coffee @@ -22,6 +22,7 @@ exports.logs = This is due to some technical limitations that we plan to address soon. Examples: + $ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 $ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 --num 20 $ resin logs 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 --tail diff --git a/lib/actions/notes.coffee b/lib/actions/notes.coffee index 16d495b2..aeba40fc 100644 --- a/lib/actions/notes.coffee +++ b/lib/actions/notes.coffee @@ -12,6 +12,7 @@ exports.set = To view the notes, use $ resin device . Examples: + $ resin note "My useful note" --device 317 $ cat note.txt | resin note --device 317 ''' diff --git a/lib/actions/os.coffee b/lib/actions/os.coffee index 924e8953..820311af 100644 --- a/lib/actions/os.coffee +++ b/lib/actions/os.coffee @@ -27,6 +27,7 @@ exports.download = You can save it to a custom location by specifying the `--output` option. Examples: + $ resin os download 91 --network ethernet $ resin os download 91 --network wifi --ssid MyNetwork --key secreykey123 $ resin os download 91 --network ethernet --output ~/MyResinOS.zip @@ -94,12 +95,15 @@ exports.install = See the `drives` command to get a list of all connected devices to your machine and their respective ids. In Mac OS X: + $ sudo diskutil unmountDisk /dev/xxx In GNU/Linux: + $ sudo umount /dev/xxx Examples: + $ resin os install rpi.iso /dev/disk2 ''' options: [ commandOptions.yes ] diff --git a/lib/actions/plugin.coffee b/lib/actions/plugin.coffee index a2c557a8..51437daf 100644 --- a/lib/actions/plugin.coffee +++ b/lib/actions/plugin.coffee @@ -10,6 +10,7 @@ exports.list = Use this command to list all the installed resin plugins. Examples: + $ resin plugins ''' permission: 'user' @@ -39,6 +40,7 @@ exports.install = Use `--quiet` to prevent information logging. Examples: + $ resin plugin install hello ''' permission: 'user' @@ -57,6 +59,7 @@ exports.update = Use `--quiet` to prevent information logging. Examples: + $ resin plugin update hello ''' permission: 'user' @@ -76,6 +79,7 @@ exports.remove = You can avoid this by passing the `--yes` boolean option. Examples: + $ resin plugin rm hello $ resin plugin rm hello --yes ''' diff --git a/lib/actions/preferences.coffee b/lib/actions/preferences.coffee index d0a61590..823d7e77 100644 --- a/lib/actions/preferences.coffee +++ b/lib/actions/preferences.coffee @@ -12,6 +12,7 @@ exports.preferences = For now, we open your default web browser and point it to the web based preferences form. Examples: + $ resin preferences ''' permission: 'user' diff --git a/package.json b/package.json index 1544d3fc..82edf962 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "scripts": { "prepublish": "gulp build", "test": "gult test", - "install": "node build/install-node.js bin/node" + "install": "node build/install-node.js bin/node", + "doc": "./scripts/extract-documentation.sh doc lib/actions" }, "keywords": [ "resin", @@ -40,6 +41,7 @@ "gulp-mocha": "~1.1.1", "gulp-shell": "^0.2.11", "gulp-util": "~3.0.1", + "mkdirp": "^0.5.0", "mocha": "~2.0.1", "mocha-notifier-reporter": "~0.1.0", "run-sequence": "~1.0.2", diff --git a/scripts/extract-documentation.sh b/scripts/extract-documentation.sh new file mode 100755 index 00000000..523c80cf --- /dev/null +++ b/scripts/extract-documentation.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +OUTPUT=$1 +INPUT=$2 + +for file in $INPUT/*.coffee; do + + # Omit this unecessary files + if [ `basename "$file"` == 'index.coffee' ] || [ `basename "$file"` == 'command-options.coffee' ]; then + continue + fi + + filename=`basename "${file%.*}"` + output=$OUTPUT/$filename + mkdir -p $output + ./node_modules/coffee-script/bin/coffee extras/capitano-doc/index.coffee markdown "$file" "$output" + echo "[CapitanoDoc] Processed $file to $output" +done