UNPKG

3.06 kBJavaScriptView Raw
1let chalk = require('chalk')
2let d = chalk.grey
3let D = chalk.grey.bold
4let g = chalk.green
5let G = chalk.green.bold
6
7let helps = {
8 help: `${G('arc [command] <options>')}
9
10${chalk.grey.bold('Usage')}
11 ${g('arc', G('init'), '[name or path]')} ${d('................... initialize project files')}
12 ${g('arc', G('sandbox'))} ${d('............................... work locally')}
13 ${g('arc', G('repl'))} ${d('.................................. repl into dynamodb')}
14 ${g('arc', G('package'))} ${d('............................... export sam.json')}
15 ${g('arc', G('deploy'), '[dirty|static|production]')} ${d('...... deploy with CFN')}
16 ${g('arc', G('logs'), 'path/to/code', '[production|nuke]')} ${d('... work with logs')}
17 ${g('arc', G('help'), '<command>')} ${d('........................ get help')}
18 ${g('arc', G('version'))} ${d('............................... get the current version')}
19 ${g('arc', G('env'))} ${d('................................... work with environment variables')}
20`,
21
22 init: `${G('arc init')}
23${d('generate project and project files based on .arc (including .arc if none exists)')}`,
24
25 package: `${G('arc package')}
26generate sam.json based on .arc`,
27
28 deploy: `${G('arc deploy')} ${g('[options]')}
29
30${d('Deploy with', D('AWS SAM'), 'to AppNameStaging stack')}
31
32${D('Options')}
33 ${g(`-p${d(',')}`, `--production${d(',')}`, 'production')} ${d('... set env to production')}
34 ${g(`-d${d(',')}`, `--dirty${d(',')}`, 'dirty')} ${d('............. *staging only* dirty deploy function code/config')}
35 ${g(`-s${d(',')}`, `--static${d(',')}`, 'static')} ${d('........... dirty deploys /public to s3 bucket')}
36 ${g(`-v${d(',')}`, `--verbose${d(',')}`, 'verbose')} ${d('......... prints all output to console')}
37 ${g(`-n${d(',')}`, `--name${d(',')}`, 'name')} ${d('............... append to stack name')}
38 ${g(`-t${d(',')}`, `--tags${d(',')}`, 'tags')} ${d('............... add key=value tags to stack')}
39`,
40
41 repl: `${G('arc repl')}
42start a repl based on .arc`,
43
44 sandbox: `${G('arc sandbox')}
45start a local web server on 3333`,
46
47 version: `${G('arc version')}
48get the current version`,
49
50 env: `${G('arc env')}
51Read and write environment variables. Sensitive configuration data, such as API keys, needs to happen outside of the codebase in revision control and you can use this tool to ensure an entire team and the deployment targets are in sync.
52${g(`arc env`)} ${d('..............................................................displays environment variables for the current .arc')}
53${g(`arc env [testing|staging|production] [VARIABLE_NAME] [value]`)} ${d('.........assigns a value to the environment variable')}
54${g(`arc env remove [testing|staging|production] [VARIABLE_NAME]`)} ${d('..........removes environment variable from environment')}
55`
56}
57
58helps.create = helps.init
59
60module.exports = function help(opts) {
61 if (opts.length === 0) {
62 console.log(helps.help)
63 }
64 else if (opts[0] && helps[opts[0]]) {
65 console.log(helps[opts[0]])
66 }
67 else {
68 console.log(`Sorry, no help found for: ${opts[0]}`)
69 }
70}