UNPKG

zapier-platform-cli

Version:

The CLI for apps in the Zapier Developer Platform.

40 lines (35 loc) 8.11 kB
'use strict'; var _ = require('lodash'); var constants = require('../constants'); var utils = require('../utils'); var help = function help(context, cmd) { var commands = require('./index'); if (commands[cmd] && commands[cmd].docs) { context.line(commands[cmd].help); context.line(); context.line('Usage: `' + commands[cmd].example + '`'); context.line(); utils.markdownLog(commands[cmd].docs.trim()); return Promise.resolve(); } context.line('Usage: zapier COMMAND [command-specific-arguments] [--command-specific-options]'.trim()); return Promise.resolve().then(function () { context.line(); var allCommands = _.orderBy(Object.keys(commands)).filter(function (name) { return !commands[name].hide; }).map(function (name) { return { name: name, help: commands[name].help, example: commands[name].example }; }); utils.printData(allCommands, [['Command', 'name'], ['Example', 'example'], ['Help', 'help']]); }); }; help.argsSpec = [{ name: 'cmd', help: 'the command to view docs for' }]; help.argOptsSpec = {}; help.help = 'Lists all the commands you can use.'; help.example = 'zapier help [command]'; help.docs = '\nPrints documentation to the terminal screen.\n\nGenerally - the `zapier` command works off of two files:\n\n * ' + constants.AUTH_LOCATION_RAW + ' (home directory identifies the deploy key & user)\n * ./' + constants.CURRENT_APP_FILE + ' (current directory identifies the app)\n\nThe `zapier login` and `zapier register "Example"` or `zapier link` commands will help manage those files. All commands listed below.\n\n**Arguments**\n\n* _none_ -- print all commands\n' + utils.argsFragment(help.argsSpec) + '\n' + utils.defaultArgOptsFragment() + '\n\n' + '```' + 'bash\n$ zapier help apps\n$ zapier help scaffold\n$ zapier help\n# Usage: zapier COMMAND [command-specific-arguments] [--command-specific-options]\n#\n# \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n# \u2502 Command \u2502 Example \u2502 Help \u2502\n# \u251C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n# \u2502 apps \u2502 zapier apps \u2502 Lists all the apps you can access. \u2502\n# \u2502 build \u2502 zapier build \u2502 Builds a uploadable zip from the current directory. \u2502\n# \u2502 collaborate \u2502 zapier collaborate [user@example.com] \u2502 Manage the collaborators on your project. Can optionally --remove. \u2502\n# \u2502 push \u2502 zapier push \u2502 Build and upload the current app - does not promote. \u2502\n# \u2502 deprecate \u2502 zapier deprecate 1.0.0 2017-01-20 \u2502 Mark a non-production version of your app as deprecated by a certain date. \u2502\n# \u2502 describe \u2502 zapier describe \u2502 Describes the current app. \u2502\n# \u2502 env \u2502 zapier env 1.0.0 CLIENT_SECRET 12345 \u2502 Read and write environment variables. \u2502\n# \u2502 help \u2502 zapier help [command] \u2502 Lists all the commands you can use. \u2502\n# \u2502 history \u2502 zapier history \u2502 Prints all recent history for your app. \u2502\n# \u2502 init \u2502 zapier init path \u2502 Initializes a new zapier app in a directory. \u2502\n# \u2502 invite \u2502 zapier invite [user@example.com] \u2502 Manage the invitees/testers on your project. Can optionally --remove. \u2502\n# \u2502 link \u2502 zapier link \u2502 Link the current directory to an app you have access to. \u2502\n# \u2502 login \u2502 zapier login \u2502 Configure your `~/.zapierrc` with a deploy key. \u2502\n$ \u2502 logout \u2502 zapier logout \u2502 Deactivates all your personal deploy keys and resets `~/.zapierrc`. \u2502\n# \u2502 logs \u2502 zapier logs \u2502 Prints recent logs. See help for filter arguments. \u2502\n# \u2502 migrate \u2502 zapier migrate 1.0.0 1.0.1 [10%] \u2502 Migrate users from one version to another. \u2502\n# \u2502 promote \u2502 zapier promote 1.0.0 \u2502 Promotes a specific version to public access. \u2502\n# \u2502 register \u2502 zapier register "Example" \u2502 Registers a new app in your account. \u2502\n# \u2502 scaffold \u2502 zapier scaffold resource "Contact" \u2502 Adds a starting resource, trigger, action or search to your app. \u2502\n# \u2502 test \u2502 zapier test \u2502 Tests your app via `npm test`. \u2502\n# \u2502 upload \u2502 zapier upload \u2502 Upload the last build as a version. \u2502\n# \u2502 validate \u2502 zapier validate \u2502 Validates the current project. \u2502\n# \u2502 versions \u2502 zapier versions \u2502 Lists all the versions of the current app. \u2502\n# \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n' + '```' + '\n'; module.exports = help;