From e4773da1d7f58f90d042acf36da0e1d55db0bf63 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Thu, 16 Apr 2015 09:34:40 -0400 Subject: [PATCH] Implement Single Page documentation --- capitanodoc.json | 96 +++ doc/app/associate.markdown | 10 - doc/app/create.markdown | 21 - doc/app/info.markdown | 7 - doc/app/init.markdown | 13 - doc/app/list.markdown | 10 - doc/app/remove.markdown | 17 - doc/app/restart.markdown | 7 - doc/auth/login.markdown | 12 - doc/auth/logout.markdown | 7 - doc/auth/signup.markdown | 31 - doc/auth/whoami.markdown | 7 - doc/cli.markdown | 759 ++++++++++++++++++ doc/device/identify.markdown | 9 - doc/device/info.markdown | 7 - doc/device/init.markdown | 50 -- doc/device/list.markdown | 13 - doc/device/remove.markdown | 17 - doc/device/rename.markdown | 10 - doc/device/supported.markdown | 7 - doc/drive/list.markdown | 7 - doc/environment-variables/add.markdown | 22 - doc/environment-variables/list.markdown | 23 - doc/environment-variables/remove.markdown | 19 - doc/environment-variables/rename.markdown | 7 - doc/examples/clone.markdown | 10 - doc/examples/info.markdown | 7 - doc/examples/list.markdown | 7 - doc/help/help.markdown | 8 - doc/info/version.markdown | 3 - doc/keys/add.markdown | 11 - doc/keys/info.markdown | 7 - doc/keys/list.markdown | 7 - doc/keys/remove.markdown | 17 - doc/notes/set.markdown | 18 - doc/os/download.markdown | 39 - doc/os/install.markdown | 34 - doc/plugin/install.markdown | 9 - doc/plugin/list.markdown | 7 - doc/plugin/remove.markdown | 17 - doc/plugin/update.markdown | 9 - doc/preferences/preferences.markdown | 10 - doc/update/update.markdown | 15 - extras/capitano-doc/index.coffee | 20 - extras/capitano-doc/markdown.coffee | 24 - extras/capitanodoc/index.coffee | 29 + extras/capitanodoc/markdown.coffee | 66 ++ .../utils.coffee | 0 package.json | 2 +- scripts/extract-documentation.sh | 18 - 50 files changed, 951 insertions(+), 631 deletions(-) create mode 100644 capitanodoc.json delete mode 100644 doc/app/associate.markdown delete mode 100644 doc/app/create.markdown delete mode 100644 doc/app/info.markdown delete mode 100644 doc/app/init.markdown delete mode 100644 doc/app/list.markdown delete mode 100644 doc/app/remove.markdown delete mode 100644 doc/app/restart.markdown delete mode 100644 doc/auth/login.markdown delete mode 100644 doc/auth/logout.markdown delete mode 100644 doc/auth/signup.markdown delete mode 100644 doc/auth/whoami.markdown create mode 100644 doc/cli.markdown delete mode 100644 doc/device/identify.markdown delete mode 100644 doc/device/info.markdown delete mode 100644 doc/device/init.markdown delete mode 100644 doc/device/list.markdown delete mode 100644 doc/device/remove.markdown delete mode 100644 doc/device/rename.markdown delete mode 100644 doc/device/supported.markdown delete mode 100644 doc/drive/list.markdown delete mode 100644 doc/environment-variables/add.markdown delete mode 100644 doc/environment-variables/list.markdown delete mode 100644 doc/environment-variables/remove.markdown delete mode 100644 doc/environment-variables/rename.markdown delete mode 100644 doc/examples/clone.markdown delete mode 100644 doc/examples/info.markdown delete mode 100644 doc/examples/list.markdown delete mode 100644 doc/help/help.markdown delete mode 100644 doc/info/version.markdown delete mode 100644 doc/keys/add.markdown delete mode 100644 doc/keys/info.markdown delete mode 100644 doc/keys/list.markdown delete mode 100644 doc/keys/remove.markdown delete mode 100644 doc/notes/set.markdown delete mode 100644 doc/os/download.markdown delete mode 100644 doc/os/install.markdown delete mode 100644 doc/plugin/install.markdown delete mode 100644 doc/plugin/list.markdown delete mode 100644 doc/plugin/remove.markdown delete mode 100644 doc/plugin/update.markdown delete mode 100644 doc/preferences/preferences.markdown delete mode 100644 doc/update/update.markdown delete mode 100644 extras/capitano-doc/index.coffee delete mode 100644 extras/capitano-doc/markdown.coffee create mode 100644 extras/capitanodoc/index.coffee create mode 100644 extras/capitanodoc/markdown.coffee rename extras/{capitano-doc => capitanodoc}/utils.coffee (100%) delete mode 100755 scripts/extract-documentation.sh diff --git a/capitanodoc.json b/capitanodoc.json new file mode 100644 index 00000000..bde77d95 --- /dev/null +++ b/capitanodoc.json @@ -0,0 +1,96 @@ +{ + "title": "Resin CLI Documentation", + "introduction": "This tool allows you to interact with the resin.io api from the comfort of your command line.\n\nTo get started download the CLI from npm.\n\n\t$ npm install resin-cli -g\n\nThen authenticate yourself:\n\n\t$ resin login\n\nNow you have access to all the commands referenced below.", + "categories": [ + { + "title": "Application", + "files": [ + "lib/actions/app.coffee" + ] + }, + { + "title": "Authentication", + "files": [ + "lib/actions/auth.coffee" + ] + }, + { + "title": "Device", + "files": [ + "lib/actions/device.coffee" + ] + }, + { + "title": "Drive", + "files": [ + "lib/actions/drive.coffee" + ] + }, + { + "title": "Environment Variables", + "files": [ + "lib/actions/environment-variables.coffee" + ] + }, + { + "title": "Examples", + "files": [ + "lib/actions/examples.coffee" + ] + }, + { + "title": "Help", + "files": [ + "lib/actions/help.coffee" + ] + }, + { + "title": "Information", + "files": [ + "lib/actions/info.coffee" + ] + }, + { + "title": "Keys", + "files": [ + "lib/actions/keys.coffee" + ] + }, + { + "title": "Logs", + "files": [ + "lib/actions/logs.coffee" + ] + }, + { + "title": "Notes", + "files": [ + "lib/actions/notes.coffee" + ] + }, + { + "title": "OS", + "files": [ + "lib/actions/os.coffee" + ] + }, + { + "title": "Plugin", + "files": [ + "lib/actions/plugin.coffee" + ] + }, + { + "title": "Preferences", + "files": [ + "lib/actions/preferences.coffee" + ] + }, + { + "title": "Update", + "files": [ + "lib/actions/update.coffee" + ] + } + ] +} diff --git a/doc/app/associate.markdown b/doc/app/associate.markdown deleted file mode 100644 index df827022..00000000 --- a/doc/app/associate.markdown +++ /dev/null @@ -1,10 +0,0 @@ -# app associate <name> - -Use this command to associate a project directory with a resin application. - -This command adds a 'resin' git remote to the directory and runs git init if necessary. - -Examples: - - $ resin app associate MyApp - $ resin app associate MyApp --project my/app/directory diff --git a/doc/app/create.markdown b/doc/app/create.markdown deleted file mode 100644 index 418ba09b..00000000 --- a/doc/app/create.markdown +++ /dev/null @@ -1,21 +0,0 @@ -# app create <name> - -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 <type> - -application type \ No newline at end of file diff --git a/doc/app/info.markdown b/doc/app/info.markdown deleted file mode 100644 index 2492ed3d..00000000 --- a/doc/app/info.markdown +++ /dev/null @@ -1,7 +0,0 @@ -# app <name> - -Use this command to show detailed information for a single application. - -Examples: - - $ resin app MyApp diff --git a/doc/app/init.markdown b/doc/app/init.markdown deleted file mode 100644 index db66b5b3..00000000 --- a/doc/app/init.markdown +++ /dev/null @@ -1,13 +0,0 @@ -# init - -Use this command to initialise a directory as a resin application. - -This command performs the following steps: - - Create a resin.io application. - - Initialize the current directory as a git repository. - - Add the corresponding git remote to the application. - -Examples: - - $ resin init - $ resin init --project my/app/directory diff --git a/doc/app/list.markdown b/doc/app/list.markdown deleted file mode 100644 index 00200d23..00000000 --- a/doc/app/list.markdown +++ /dev/null @@ -1,10 +0,0 @@ -# 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.markdown b/doc/app/remove.markdown deleted file mode 100644 index 8da33cf0..00000000 --- a/doc/app/remove.markdown +++ /dev/null @@ -1,17 +0,0 @@ -# app rm <name> - -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 MyApp - $ resin app rm MyApp --yes - -## Options - -### --yes, -y - -confirm non interactively \ No newline at end of file diff --git a/doc/app/restart.markdown b/doc/app/restart.markdown deleted file mode 100644 index e9d4d6d1..00000000 --- a/doc/app/restart.markdown +++ /dev/null @@ -1,7 +0,0 @@ -# app restart <name> - -Use this command to restart all devices that belongs to a certain application. - -Examples: - - $ resin app restart MyApp diff --git a/doc/auth/login.markdown b/doc/auth/login.markdown deleted file mode 100644 index cedda322..00000000 --- a/doc/auth/login.markdown +++ /dev/null @@ -1,12 +0,0 @@ -# login [token] - -Use this command to login to your resin.io account. - -To login, you need your token, which is accesible from the preferences page: - - https://dashboard.resin.io/preferences?tab=details - -Examples: - - $ resin login - $ resin login "eyJ0eXAiOiJKV1Qi..." diff --git a/doc/auth/logout.markdown b/doc/auth/logout.markdown deleted file mode 100644 index 2b7ffc12..00000000 --- a/doc/auth/logout.markdown +++ /dev/null @@ -1,7 +0,0 @@ -# logout - -Use this command to logout from your resin.io account.o - -Examples: - - $ resin logout diff --git a/doc/auth/signup.markdown b/doc/auth/signup.markdown deleted file mode 100644 index 6618ec80..00000000 --- a/doc/auth/signup.markdown +++ /dev/null @@ -1,31 +0,0 @@ -# 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 <email> - -user email - -### --username, -u <username> - -user name - -### --password, -p <user password> - -user password \ No newline at end of file diff --git a/doc/auth/whoami.markdown b/doc/auth/whoami.markdown deleted file mode 100644 index 9151a9e5..00000000 --- a/doc/auth/whoami.markdown +++ /dev/null @@ -1,7 +0,0 @@ -# whoami - -Use this command to find out the current logged in username. - -Examples: - - $ resin whoami diff --git a/doc/cli.markdown b/doc/cli.markdown new file mode 100644 index 00000000..b34c9c75 --- /dev/null +++ b/doc/cli.markdown @@ -0,0 +1,759 @@ +# Resin CLI Documentation + +This tool allows you to interact with the resin.io api from the comfort of your command line. + +To get started download the CLI from npm. + + $ npm install resin-cli -g + +Then authenticate yourself: + + $ resin login + +Now you have access to all the commands referenced below. + +# Table of contents + +- Application + + - app create + - apps + - app + - app restart + - app rm + - app associate + - init + +- Authentication + + - whoami + - login [token] + - logout + - signup + +- Device + + - devices + - device + - device rm + - device identify + - device rename [newName] + - devices supported + - device init [device] + +- Drive + + - drives + +- Environment Variables + + - envs + - env rm + - env add [value] + - env rename + +- Examples + + - examples + - example + - example clone + +- Help + + - help [command...] + +- Information + + - version + +- Keys + + - keys + - key + - key rm + - key add [path] + +- Logs + + - logs + +- Notes + + - note <|note> + +- OS + + - os download + - os install [device] + +- Plugin + + - plugins + - plugin install + - plugin update + - plugin rm + +- Preferences + + - preferences + +- Update + + - update + +# Application +## app create <name> + +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 <type> + +application type + +## 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 + +## app <name> + +Use this command to show detailed information for a single application. + +Examples: + + $ resin app MyApp + +## app restart <name> + +Use this command to restart all devices that belongs to a certain application. + +Examples: + + $ resin app restart MyApp + +## app rm <name> + +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 MyApp + $ resin app rm MyApp --yes + +### Options + +#### --yes, -y + +confirm non interactively + +## app associate <name> + +Use this command to associate a project directory with a resin application. + +This command adds a 'resin' git remote to the directory and runs git init if necessary. + +Examples: + + $ resin app associate MyApp + $ resin app associate MyApp --project my/app/directory + +## init + +Use this command to initialise a directory as a resin application. + +This command performs the following steps: + - Create a resin.io application. + - Initialize the current directory as a git repository. + - Add the corresponding git remote to the application. + +Examples: + + $ resin init + $ resin init --project my/app/directory + +# Authentication +## whoami + +Use this command to find out the current logged in username. + +Examples: + + $ resin whoami + +## login [token] + +Use this command to login to your resin.io account. + +To login, you need your token, which is accesible from the preferences page: + + https://staging.resin.io/preferences + +Examples: + + $ resin login + $ resin login "eyJ0eXAiOiJKV1Qi..." + +## logout + +Use this command to logout from your resin.io account.o + +Examples: + + $ resin logout + +## 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 <email> + +user email + +#### --username, -u <username> + +user name + +#### --password, -p <user password> + +user password + +# Device +## devices + +Use this command to list all devices that belong to a certain application. + +Examples: + + $ resin devices --application MyApp + +### Options + +#### --application, --a,app, --a,app <application> + +application name + +## device <name> + +Use this command to show information about a single device. + +Examples: + + $ resin device MyDevice + +## device rm <name> + +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 MyDevice + $ resin device rm MyDevice --yes + +### Options + +#### --yes, -y + +confirm non interactively + +## device identify <uuid> + +Use this command to identify a device. + +In the Raspberry Pi, the ACT led is blinked several times. + +Examples: + + $ resin device identify 23c73a12e3527df55c60b9ce647640c1b7da1b32d71e6a39849ac0f00db828 + +## device rename <name> [newName] + +Use this command to rename a device. + +If you omit the name, you'll get asked for it interactively. + +Examples: + + $ resin device rename MyDevice MyPi + $ resin device rename MyDevice + +## devices supported + +Use this command to get the list of all supported devices + +Examples: + + $ resin devices supported + +## 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. + +You can omit network related options to be asked about them interactively. + +Examples: + + $ resin device init + $ resin device init --application 91 + $ 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> + +application name + +#### --network, -n <network> + +network type + +#### --ssid, -s <ssid> + +wifi ssid, if network is wifi + +#### --key, -k <key> + +wifi key, if network is wifi + +# Drive +## drives + +Use this command to list all drives that are connected to your machine. + +Examples: + + $ resin drives + +# Environment Variables +## 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> + +application name + +#### --verbose, -v + +show private environment variables + +## env rm <id> + +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 + +## env add <key> [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> + +application name + +## env rename <id> <value> + +Use this command to rename an enviroment variable from an application. + +Examples: + + $ resin env rename 376 emacs + +# Examples +## examples + +Use this command to list available example applications from resin.io + +Example: + + $ resin examples + +## example <id> + +Use this command to show information of a single example application + +Example: + + $ resin example 3 + +## example clone <id> + +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 + +# Help +## help [command...] + +Get detailed help for an specific command. + +Examples: + + $ resin help apps + $ resin help os download + +# Information +## version + +Display the Resin CLI version. + +# Keys +## keys + +Use this command to list all your SSH keys. + +Examples: + + $ resin keys + +## key <id> + +Use this command to show information about a single SSH key. + +Examples: + + $ resin key 17 + +## key rm <id> + +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 + +## key add <name> [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 + +# Logs +## logs <uuid> + +Use this command to show logs for a specific device. + +By default, the command prints all log messages and exit. + +To limit the output to the n last lines, use the `--num` option along with a number. +This is similar to doing `resin logs | tail -n X`. + +To continuously stream output, and see new logs in real time, use the `--tail` option. + +Note that for now you need to provide the whole UUID for this command to work correctly, +and the tool won't notice if you're using an invalid UUID. + +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 + +### Options + +#### --num, -n <num> + +number of lines to display + +#### --tail, -t + +continuously stream output + +# Notes +## 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 MyDevice + $ cat note.txt | resin note --device MyDevice + +### Options + +#### --device, --d,dev, --d,dev <device> + +device name + +# OS +## os download <id> + +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. + +Alternatively, you can omit all kind of network configuration options to configure interactively. + +You have to specify an output location with the `--output` option. + +Examples: + + $ resin os download 91 --output ~/MyResinOS.zip + $ resin os download 91 --network ethernet --output ~/MyResinOS.zip + $ resin os download 91 --network wifi --ssid MyNetwork --key secreykey123 --output ~/MyResinOS.zip + $ resin os download 91 --network ethernet --output ~/MyResinOS.zip + +### Options + +#### --network, -n <network> + +network type + +#### --ssid, -s <ssid> + +wifi ssid, if network is wifi + +#### --key, -k <key> + +wifi key, if network is wifi + +#### --output, -o <output> + +output file + +## os install <image> [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 + +# Plugin +## plugins + +Use this command to list all the installed resin plugins. + +Examples: + + $ resin plugins + +## plugin install <name> + +Use this command to install a resin plugin + +Use `--quiet` to prevent information logging. + +Examples: + + $ resin plugin install hello + +## plugin update <name> + +Use this command to update a resin plugin + +Use `--quiet` to prevent information logging. + +Examples: + + $ resin plugin update hello + +## plugin rm <name> + +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 + +# Preferences +## 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 + +# Update +## update + +Use this command to update the Resin CLI + +This command outputs information about the update process. +Use `--quiet` to remove that output. + +The Resin CLI checks for updates once per day. + +Major updates require a manual update with this update command, +while minor updates are applied automatically. + +Examples: + + $ resin update + diff --git a/doc/device/identify.markdown b/doc/device/identify.markdown deleted file mode 100644 index 930efa6a..00000000 --- a/doc/device/identify.markdown +++ /dev/null @@ -1,9 +0,0 @@ -# device identify <uuid> - -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.markdown b/doc/device/info.markdown deleted file mode 100644 index b5e02f24..00000000 --- a/doc/device/info.markdown +++ /dev/null @@ -1,7 +0,0 @@ -# device <name> - -Use this command to show information about a single device. - -Examples: - - $ resin device MyDevice diff --git a/doc/device/init.markdown b/doc/device/init.markdown deleted file mode 100644 index 1de345d1..00000000 --- a/doc/device/init.markdown +++ /dev/null @@ -1,50 +0,0 @@ -# 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. - -You can omit network related options to be asked about them interactively. - -Examples: - - $ resin device init - $ resin device init --application 91 - $ 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> - -application name - -### --network, -n <network> - -network type - -### --ssid, -s <ssid> - -wifi ssid, if network is wifi - -### --key, -k <key> - -wifi key, if network is wifi \ No newline at end of file diff --git a/doc/device/list.markdown b/doc/device/list.markdown deleted file mode 100644 index 05dd15ab..00000000 --- a/doc/device/list.markdown +++ /dev/null @@ -1,13 +0,0 @@ -# devices - -Use this command to list all devices that belong to a certain application. - -Examples: - - $ resin devices --application MyApp - -## Options - -### --application, --a,app, --a,app <application> - -application name \ No newline at end of file diff --git a/doc/device/remove.markdown b/doc/device/remove.markdown deleted file mode 100644 index fb1a7c2b..00000000 --- a/doc/device/remove.markdown +++ /dev/null @@ -1,17 +0,0 @@ -# device rm <name> - -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 MyDevice - $ resin device rm MyDevice --yes - -## Options - -### --yes, -y - -confirm non interactively \ No newline at end of file diff --git a/doc/device/rename.markdown b/doc/device/rename.markdown deleted file mode 100644 index 7ea1a5db..00000000 --- a/doc/device/rename.markdown +++ /dev/null @@ -1,10 +0,0 @@ -# device rename <name> [newName] - -Use this command to rename a device. - -If you omit the name, you'll get asked for it interactively. - -Examples: - - $ resin device rename MyDevice MyPi - $ resin device rename MyDevice diff --git a/doc/device/supported.markdown b/doc/device/supported.markdown deleted file mode 100644 index dc867a6d..00000000 --- a/doc/device/supported.markdown +++ /dev/null @@ -1,7 +0,0 @@ -# devices supported - -Use this command to get the list of all supported devices - -Examples: - - $ resin devices supported diff --git a/doc/drive/list.markdown b/doc/drive/list.markdown deleted file mode 100644 index a52faee0..00000000 --- a/doc/drive/list.markdown +++ /dev/null @@ -1,7 +0,0 @@ -# drives - -Use this command to list all drives that are connected to your machine. - -Examples: - - $ resin drives diff --git a/doc/environment-variables/add.markdown b/doc/environment-variables/add.markdown deleted file mode 100644 index 9a3dddcb..00000000 --- a/doc/environment-variables/add.markdown +++ /dev/null @@ -1,22 +0,0 @@ -# env add <key> [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> - -application name \ No newline at end of file diff --git a/doc/environment-variables/list.markdown b/doc/environment-variables/list.markdown deleted file mode 100644 index 3bdb4d2d..00000000 --- a/doc/environment-variables/list.markdown +++ /dev/null @@ -1,23 +0,0 @@ -# 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> - -application name - -### --verbose, -v - -show private environment variables \ No newline at end of file diff --git a/doc/environment-variables/remove.markdown b/doc/environment-variables/remove.markdown deleted file mode 100644 index bc2d6e3d..00000000 --- a/doc/environment-variables/remove.markdown +++ /dev/null @@ -1,19 +0,0 @@ -# env rm <id> - -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.markdown b/doc/environment-variables/rename.markdown deleted file mode 100644 index 5872b9d9..00000000 --- a/doc/environment-variables/rename.markdown +++ /dev/null @@ -1,7 +0,0 @@ -# env rename <id> <value> - -Use this command to rename an enviroment variable from an application. - -Examples: - - $ resin env rename 376 emacs diff --git a/doc/examples/clone.markdown b/doc/examples/clone.markdown deleted file mode 100644 index c32ab31d..00000000 --- a/doc/examples/clone.markdown +++ /dev/null @@ -1,10 +0,0 @@ -# example clone <id> - -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.markdown b/doc/examples/info.markdown deleted file mode 100644 index b01c88a5..00000000 --- a/doc/examples/info.markdown +++ /dev/null @@ -1,7 +0,0 @@ -# example <id> - -Use this command to show information of a single example application - -Example: - - $ resin example 3 diff --git a/doc/examples/list.markdown b/doc/examples/list.markdown deleted file mode 100644 index df82088c..00000000 --- a/doc/examples/list.markdown +++ /dev/null @@ -1,7 +0,0 @@ -# examples - -Use this command to list available example applications from resin.io - -Example: - - $ resin examples diff --git a/doc/help/help.markdown b/doc/help/help.markdown deleted file mode 100644 index 475f0b79..00000000 --- a/doc/help/help.markdown +++ /dev/null @@ -1,8 +0,0 @@ -# help [command...] - -Get detailed help for an specific command. - -Examples: - - $ resin help apps - $ resin help os download diff --git a/doc/info/version.markdown b/doc/info/version.markdown deleted file mode 100644 index 9cafac28..00000000 --- a/doc/info/version.markdown +++ /dev/null @@ -1,3 +0,0 @@ -# version - -Display the Resin CLI version. diff --git a/doc/keys/add.markdown b/doc/keys/add.markdown deleted file mode 100644 index ce8436ca..00000000 --- a/doc/keys/add.markdown +++ /dev/null @@ -1,11 +0,0 @@ -# key add <name> [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.markdown b/doc/keys/info.markdown deleted file mode 100644 index 20ade999..00000000 --- a/doc/keys/info.markdown +++ /dev/null @@ -1,7 +0,0 @@ -# key <id> - -Use this command to show information about a single SSH key. - -Examples: - - $ resin key 17 diff --git a/doc/keys/list.markdown b/doc/keys/list.markdown deleted file mode 100644 index 4217e316..00000000 --- a/doc/keys/list.markdown +++ /dev/null @@ -1,7 +0,0 @@ -# keys - -Use this command to list all your SSH keys. - -Examples: - - $ resin keys diff --git a/doc/keys/remove.markdown b/doc/keys/remove.markdown deleted file mode 100644 index a574a604..00000000 --- a/doc/keys/remove.markdown +++ /dev/null @@ -1,17 +0,0 @@ -# key rm <id> - -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.markdown b/doc/notes/set.markdown deleted file mode 100644 index 18930288..00000000 --- a/doc/notes/set.markdown +++ /dev/null @@ -1,18 +0,0 @@ -# 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 MyDevice - $ cat note.txt | resin note --device MyDevice - -## Options - -### --device, --d,dev, --d,dev <device> - -device name \ No newline at end of file diff --git a/doc/os/download.markdown b/doc/os/download.markdown deleted file mode 100644 index d561b4aa..00000000 --- a/doc/os/download.markdown +++ /dev/null @@ -1,39 +0,0 @@ -# os download <id> - -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. - -Alternatively, you can omit all kind of network configuration options to configure interactively. - -You have to specify an output location with the `--output` option. - -Examples: - - $ resin os download 91 --output ~/MyResinOS.zip - $ resin os download 91 --network ethernet --output ~/MyResinOS.zip - $ resin os download 91 --network wifi --ssid MyNetwork --key secreykey123 --output ~/MyResinOS.zip - $ resin os download 91 --network ethernet --output ~/MyResinOS.zip - -## Options - -### --network, -n <network> - -network type - -### --ssid, -s <ssid> - -wifi ssid, if network is wifi - -### --key, -k <key> - -wifi key, if network is wifi - -### --output, -o <output> - -output file \ No newline at end of file diff --git a/doc/os/install.markdown b/doc/os/install.markdown deleted file mode 100644 index 1bb08ea1..00000000 --- a/doc/os/install.markdown +++ /dev/null @@ -1,34 +0,0 @@ -# os install <image> [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.markdown b/doc/plugin/install.markdown deleted file mode 100644 index d9e8ebfb..00000000 --- a/doc/plugin/install.markdown +++ /dev/null @@ -1,9 +0,0 @@ -# plugin install <name> - -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.markdown b/doc/plugin/list.markdown deleted file mode 100644 index 9c7cc9f9..00000000 --- a/doc/plugin/list.markdown +++ /dev/null @@ -1,7 +0,0 @@ -# plugins - -Use this command to list all the installed resin plugins. - -Examples: - - $ resin plugins diff --git a/doc/plugin/remove.markdown b/doc/plugin/remove.markdown deleted file mode 100644 index 41028ea0..00000000 --- a/doc/plugin/remove.markdown +++ /dev/null @@ -1,17 +0,0 @@ -# plugin rm <name> - -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.markdown b/doc/plugin/update.markdown deleted file mode 100644 index 8d5aaac8..00000000 --- a/doc/plugin/update.markdown +++ /dev/null @@ -1,9 +0,0 @@ -# plugin update <name> - -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.markdown b/doc/preferences/preferences.markdown deleted file mode 100644 index c4a8c805..00000000 --- a/doc/preferences/preferences.markdown +++ /dev/null @@ -1,10 +0,0 @@ -# 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/doc/update/update.markdown b/doc/update/update.markdown deleted file mode 100644 index 76cd06e8..00000000 --- a/doc/update/update.markdown +++ /dev/null @@ -1,15 +0,0 @@ -# update - -Use this command to update the Resin CLI - -This command outputs information about the update process. -Use `--quiet` to remove that output. - -The Resin CLI checks for updates once per day. - -Major updates require a manual update with this update command, -while minor updates are applied automatically. - -Examples: - - $ resin update diff --git a/extras/capitano-doc/index.coffee b/extras/capitano-doc/index.coffee deleted file mode 100644 index b59c8c47..00000000 --- a/extras/capitano-doc/index.coffee +++ /dev/null @@ -1,20 +0,0 @@ -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}.markdown") - 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 deleted file mode 100644 index 9bcb72e4..00000000 --- a/extras/capitano-doc/markdown.coffee +++ /dev/null @@ -1,24 +0,0 @@ -_ = require('lodash') -ent = require('ent') -utils = require('./utils') - -exports.option = (option) -> - result = utils.parseSignature(option) - -exports.command = (command) -> - result = """ - # #{ent.encode(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/capitanodoc/index.coffee b/extras/capitanodoc/index.coffee new file mode 100644 index 00000000..dede7327 --- /dev/null +++ b/extras/capitanodoc/index.coffee @@ -0,0 +1,29 @@ +_ = require('lodash') +capitanodoc = require('../../capitanodoc.json') +markdown = require('./markdown') + +result = {} +result.title = capitanodoc.title +result.introduction = capitanodoc.introduction +result.categories = [] + +for commandCategory in capitanodoc.categories + category = {} + category.title = commandCategory.title + category.commands = [] + + for file in commandCategory.files + actions = require(file) + + for actionName, actionCommand of actions + category.commands.push(_.omit(actionCommand, 'action')) + + result.categories.push(category) + +result.toc = _.cloneDeep(result.categories) +result.toc = _.map result.toc, (category) -> + category.commands = _.map category.commands, (command) -> + return command.signature + return category + +console.log(markdown.display(result)) diff --git a/extras/capitanodoc/markdown.coffee b/extras/capitanodoc/markdown.coffee new file mode 100644 index 00000000..ff8d6ff7 --- /dev/null +++ b/extras/capitanodoc/markdown.coffee @@ -0,0 +1,66 @@ +_ = require('lodash') +ent = require('ent') +utils = require('./utils') + +exports.command = (command) -> + result = """ + ## #{ent.encode(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} + """ + + result += '\n' + + return result + +exports.category = (category) -> + result = """ + # #{category.title} + """ + + for command in category.commands + result += '\n' + exports.command(command) + + return result + +exports.toc = (toc) -> + result = ''' + # Table of contents\n + ''' + + for category in toc + + result += """ + \n- #{category.title}\n\n + """ + + for command in category.commands + result += """ + \t- #{command}\n + """ + + return result + +exports.display = (doc) -> + result = """ + # #{doc.title} + + #{doc.introduction} + + #{exports.toc(doc.toc)} + """ + + for category in doc.categories + result += '\n' + exports.category(category) + + return result diff --git a/extras/capitano-doc/utils.coffee b/extras/capitanodoc/utils.coffee similarity index 100% rename from extras/capitano-doc/utils.coffee rename to extras/capitanodoc/utils.coffee diff --git a/package.json b/package.json index 5fb3b033..e4f258f2 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "scripts": { "prepublish": "gulp build", "test": "gulp test", - "doc": "./scripts/extract-documentation.sh doc lib/actions" + "doc": "mkdir -p doc/ && coffee extras/capitanodoc/index.coffee > doc/cli.markdown" }, "keywords": [ "resin", diff --git a/scripts/extract-documentation.sh b/scripts/extract-documentation.sh deleted file mode 100755 index 523c80cf..00000000 --- a/scripts/extract-documentation.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/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