{"id":28684873,"url":"https://github.com/node-modules/common-bin-plus","last_synced_at":"2025-06-14T03:07:22.494Z","repository":{"id":33865410,"uuid":"161613410","full_name":"node-modules/common-bin-plus","owner":"node-modules","description":"advanced common-bin for cli usage","archived":false,"fork":false,"pushed_at":"2022-11-10T11:06:13.000Z","size":26,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-05-06T03:04:02.243Z","etag":null,"topics":["common-bin"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/node-modules.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-13T09:14:56.000Z","updated_at":"2023-07-12T13:59:18.000Z","dependencies_parsed_at":"2023-01-15T03:03:06.040Z","dependency_job_id":null,"html_url":"https://github.com/node-modules/common-bin-plus","commit_stats":null,"previous_names":["node-modules/common-bin-plus","alibaba-archive/common-bin-plus"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/node-modules/common-bin-plus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fcommon-bin-plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fcommon-bin-plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fcommon-bin-plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fcommon-bin-plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-modules","download_url":"https://codeload.github.com/node-modules/common-bin-plus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fcommon-bin-plus/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259699680,"owners_count":22898308,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["common-bin"],"created_at":"2025-06-14T03:07:21.141Z","updated_at":"2025-06-14T03:07:22.482Z","avatar_url":"https://github.com/node-modules.png","language":"JavaScript","readme":"# common-bin-plus\n\nadvanced [common-bin](https://github.com/node-modules/common-bin) for cli usage\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![NPM download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/common-bin-plus.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/common-bin-plus\n[travis-image]: https://img.shields.io/travis/node-modules/common-bin-plus.svg?style=flat-square\n[travis-url]: https://travis-ci.org/node-modules/common-bin-plus\n[codecov-image]: https://codecov.io/gh/node-modules/common-bin-plus/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/node-modules/common-bin-plus\n[david-image]: https://img.shields.io/david/node-modules/common-bin-plus.svg?style=flat-square\n[david-url]: https://david-dm.org/node-modules/common-bin-plus\n[snyk-image]: https://snyk.io/test/npm/common-bin-plus/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/common-bin-plus\n[download-image]: https://img.shields.io/npm/dm/common-bin-plus.svg?style=flat-square\n[download-url]: https://npmjs.org/package/common-bin-plus\n\n## Installation\n\n```bash\nnpm i common-bin-plus --save\n```\n\n## Write your own cli\n\nsee [common-bin](https://github.com/node-modules/common-bin) for more details.\n\n## Feature\n\n### Logger\n\nhttps://github.com/unjs/consola\n\n```js\nthis.logger.info('hello info level');\nthis.logger.warn('hello warn level');\nthis.logger.error(new Error('hello error level'));\nthis.logger.debug('hello debug level');\n```\n\n`debug` log is disabled by default, you could enable it by:\n\n- command line argv: `--verbose`\n- process env: `DEBUG=*` or `DEBUG=${cliName}`\n- programmatically: `logger.level = 'DEBUG'`\n\n## Prompt\n\n```js\nconst answers = await this.prompt([\n  {\n    type: 'input',\n    name: 'name',\n    message: 'What is your name:',\n  }, {\n    type: 'list',\n    name: 'type',\n    message: 'Choose a boilerplate:',\n    choices: [ 'empty', 'simple', 'plugin', 'framework' ],\n  },\n], {});\n\nthis.logger.info(answers);\n```\n\n## Unit Testing\n\nUse [coffee](https://github.com/node-modules/coffee) :\n\n```js\nconst coffee = require('coffee');\n\ndescribe('test/index.test.js', () =\u003e {\n  it('should work', () =\u003e {\n    return coffee.fork('/path/to/cli')\n      // .debug()\n      .waitForPrompt()\n      .write('tz\\n')\n      .writeKey('DOWN', 'ENTER')\n      .write('this is a desc\\n')\n      .expect('stdout', /{ name: 'tz', type: 'simple' }/)\n      .expect('stdout', /{ description: 'this is a desc' }/)\n      .expect('code', 0)\n      .end();\n  });\n}):\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Fcommon-bin-plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-modules%2Fcommon-bin-plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Fcommon-bin-plus/lists"}