{"name":"sywac","version":"2.0.0-rc4","description":"So you want a CLI...","main":"index.js","scripts":{"pretest":"standard","test":"tap","coverage":"nyc report --reporter=text-lcov | coveralls"},"engines":{"node":">=8"},"repository":{"type":"git","url":"git+https://github.com/sywac/sywac.git"},"keywords":["cli","parser","command","args","argv"],"author":{"name":"nexdrew"},"license":"MIT","bugs":{"url":"https://github.com/sywac/sywac/issues"},"homepage":"https://sywac.io","devDependencies":{"chalk":"^4.0.0","coveralls":"^3.0.9","del":"^5.1.0","import-fresh":"^3.2.1","standard":"^14.3.2","tap":"^14.10.6"},"readme":"# ![sywac](logo.png)\n\n> So you want a CLI...\n\n[![Build Status](https://travis-ci.com/sywac/sywac.svg?branch=master)](https://travis-ci.com/sywac/sywac)\n[![Coverage Status](https://coveralls.io/repos/github/sywac/sywac/badge.svg?branch=master)](https://coveralls.io/github/sywac/sywac?branch=master)\n[![JavaScript Style Guide](https://badgen.net/badge/code%20style/standard/green)](https://standardjs.com)\n![Dependabot Badge](https://badgen.net/dependabot/sywac/sywac?icon=dependabot)\n\nA better CLI framework, made for the ES2015 era.\n\nVisit https://sywac.io for detailed documentation. **NOTE!** The docs site is still under construction.\n\n## Feature Highlights\n\n- Single package install\n- Asynchronous parsing, validation, and command execution\n- Type-based argument parsing\n- Plug in your own types or override/extend the built-in ones\n- Support for simple CLIs or complex nested command trees\n- First-class support for positional arguments, with or without commands\n- Flexible auto-generated help content\n- Support for ANSI styles/colors (we recommend [chalk](https://github.com/chalk/chalk))\n- Define styles/colors inline or decorate content with style hooks\n- Coherent API\n- Parse strings as easily as `process.argv`\n- Supports concurrent parsing, safe for chatbots or other server-side apps\n\n## Quick Start Guide\n\nFirst install sywac from npm:\n\n```console\n$ npm install --save sywac\n```\n\nThen create a `cli.js` file with code similar to this:\n\n```js\n#!/usr/bin/env node\n\nconst cli = require('sywac')\n  .positional('<string>', { paramsDesc: 'A required string argument' })\n  .boolean('-b, --bool', { desc: 'A boolean option' })\n  .number('-n, --num <number>', { desc: 'A number option' })\n  .help('-h, --help')\n  .version('-v, --version')\n  .showHelpByDefault()\n  .outputSettings({ maxWidth: 75 })\n\nmodule.exports = cli\n\nasync function main () {\n  const argv = await cli.parseAndExit()\n  console.log(JSON.stringify(argv, null, 2))\n}\n\nif (require.main === module) main()\n```\n\nMake the `cli.js` file executable:\n\n```console\n$ chmod +x cli.js\n```\n\nAnd set up `cli.js` as the `\"bin\"` field in `package.json`:\n\n```json\n{\n  \"name\": \"example\",\n  \"version\": \"0.1.0\",\n  \"bin\": \"cli.js\"\n}\n```\n\n> Tip:\n>\n> You can use `npm init sywac` to easily set up the above and add sywac to your project.\n\nThen test it out. Without any arguments, it will print the help text.\n\n```console\n$ ./cli.js\nUsage: cli <string> [options]\n\nArguments:\n  <string>  A required string argument                  [required] [string]\n\nOptions:\n  -b, --bool          A boolean option                            [boolean]\n  -n, --num <number>  A number option                              [number]\n  -h, --help          Show help                  [commands: help] [boolean]\n  -v, --version       Show version number     [commands: version] [boolean]\n```\n\nLet's try passing some arguments:\n\n```console\n$ ./cli.js hello -b -n 42\n{\n  \"_\": [],\n  \"string\": \"hello\",\n  \"b\": true,\n  \"bool\": true,\n  \"n\": 42,\n  \"num\": 42,\n  \"h\": false,\n  \"help\": false,\n  \"v\": false,\n  \"version\": false\n}\n```\n\nWhat happens if we pass flags without a string argument?\n\n```console\n$ ./cli.js --bool\nUsage: cli <string> [options]\n\nArguments:\n  <string>  A required string argument                  [required] [string]\n\nOptions:\n  -b, --bool          A boolean option                            [boolean]\n  -n, --num <number>  A number option                              [number]\n  -h, --help          Show help                  [commands: help] [boolean]\n  -v, --version       Show version number     [commands: version] [boolean]\n\nMissing required argument: string\n```\n\nValidation failed and sywac printed the help text with an error message. Let's check the exit code of that last run:\n\n```console\n$ echo $?\n1\n```\n\nThis is a good sign that our CLI will play well with others.\n\n## API\n\nFor details on the full API, go to http://sywac.io\n\n## License\n\nMIT\n","readmeFilename":"README.md","gitHead":"201f77717728606bf64d77ee3a836a942dd19a34","_id":"sywac@2.0.0-rc4","_nodeVersion":"12.18.3","_npmVersion":"6.14.7","dist":{"integrity":"sha512-OVFuD8quq9JcJ5K/kaQFaaNletTRnvR4ZLu+HkuMgBnk8vfFpglwDRhbGUZ95hgebAVEJgsnVGr2l9cF9OPu2A==","shasum":"80c7f19e48bf9dbaaed88b20e5b8c1949efc9345","tarball":"http://registry-npm.ywwl.com/sywac/download/sywac-2.0.0-rc4.tgz","fileCount":22,"unpackedSize":105136,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfHGmTCRA9TVsSAnZWagAABRMP/jkAGx0AnrziuPfGyXZx\nZYgeCU9X0NDhdLGUqrN38egb9VO/zSAOH/ew5LAOMU0TtiqwZ8e+YahS/PI5\ng/1HBtDNlImMJemoch8ZafPFNgj+8L1WoXUkfV2s1Lr0/YQe44/Z0L0Chnpg\nDUl2DXMBEPtm1WuxjulyNQoJxZIAqI5QN1846/yWxU60cExg2cSpr0FM6aCQ\nvzjsrlH+Ucn+WnxBsgMAVXLRUJoahNbGIa6GZdR1LvDHubNgGN/qPDDlMabF\nga1gRPgSqwEh7hSjMggowO/St6y47DP18fMD3B9417fQLScQjVJiEoU4Zr/r\nAe0GqzcVjUW7xdxGFY4Sx1JgtuAT9VaRGxc3Cs7P/C/vw6Yvc8bogvuDHkRJ\ntsgOeIpo3iBuL2lMuTy6np1AuPYaWxRFBm5O9VdrDep5tUwxmqcSZXWSXVQw\nJQm6GOQV04OQIldLJSBSYD4g7xil02SKvuBFUVKXFuLBdQjV2TQau0zAum6F\nUtutfgrbCznfYwFUMu0D8hWJFuQYPDMLkAYhotZI0OFLFgFeDkFn1kOyujpJ\nXD1zDYJ0cj9kLeVM9AV4RfFkrAIbaMQkzvHVJT7pz4bND0oigjVP5Sayzmc7\n/1vmFXZ871BaD+akdCc3BGs/L0O4Ckh/xi0TbC+RQDdBE6/fDWXNR15jP6nu\naaDP\r\n=OLGD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDAx1NYw314PH7Lud3PsYifDnP3CyivBQ4QkWFyb9LyEwIhAMDN05j1cc2x2fO6KnvIGOuCaCRnjYS1SGSes498jGge"}],"size":27576,"noattachment":false,"key":"/sywac/-/sywac-2.0.0-rc4.tgz"},"maintainers":[{"name":"nexdrew","email":"andrewbgoode@gmail.com"}],"_npmUser":{"name":"nexdrew","email":"andrewbgoode@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sywac_2.0.0-rc4_1595697555009_0.07946546314981728"},"_hasShrinkwrap":false,"publish_time":1595697555133,"_cnpm_publish_time":1595697555133,"dist-tags":{"latest":"1.3.0","rc":"2.0.0-rc4"}}