{"id":13547593,"url":"https://github.com/75lb/command-line-usage","last_synced_at":"2025-05-15T16:08:40.219Z","repository":{"id":46323015,"uuid":"38204029","full_name":"75lb/command-line-usage","owner":"75lb","description":"A simple, data-driven module for creating a usage guide.","archived":false,"fork":false,"pushed_at":"2024-07-18T16:24:29.000Z","size":4746,"stargazers_count":217,"open_issues_count":0,"forks_count":36,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T21:13:16.134Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/75lb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-06-28T15:34:51.000Z","updated_at":"2025-03-27T21:47:16.000Z","dependencies_parsed_at":"2024-06-18T12:26:44.523Z","dependency_job_id":"fe0767a0-776a-4cf5-832e-1f5e064abc5a","html_url":"https://github.com/75lb/command-line-usage","commit_stats":{"total_commits":243,"total_committers":5,"mean_commits":48.6,"dds":"0.016460905349794275","last_synced_commit":"a00f7b832869b57755567b3c87b67109f1363c97"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcommand-line-usage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcommand-line-usage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcommand-line-usage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcommand-line-usage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/75lb","download_url":"https://codeload.github.com/75lb/command-line-usage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248480426,"owners_count":21110937,"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":[],"created_at":"2024-08-01T12:00:58.517Z","updated_at":"2025-04-11T21:13:39.193Z","avatar_url":"https://github.com/75lb.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"[![view on npm](https://badgen.net/npm/v/command-line-usage)](https://www.npmjs.org/package/command-line-usage)\n[![npm module downloads](https://badgen.net/npm/dt/command-line-usage)](https://www.npmjs.org/package/command-line-usage)\n[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/command-line-usage)](https://github.com/75lb/command-line-usage/network/dependents?dependent_type=REPOSITORY)\n[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/command-line-usage)](https://github.com/75lb/command-line-usage/network/dependents?dependent_type=PACKAGE)\n[![Node.js CI](https://github.com/75lb/command-line-usage/actions/workflows/node.js.yml/badge.svg)](https://github.com/75lb/command-line-usage/actions/workflows/node.js.yml)\n[![Coverage Status](https://coveralls.io/repos/github/75lb/command-line-usage/badge.svg)](https://coveralls.io/github/75lb/command-line-usage)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)\n\n# command-line-usage\n\n***Upgraders, please check the [release notes](https://github.com/75lb/command-line-usage/releases).***\n\nA simple, data-driven module for creating a usage guide.\n\n## Synopsis\n\nA usage guide is created by first defining an arbitrary number of sections, e.g. a description section, synopsis, option list, examples, footer etc. Each section has an optional header, some content and must be of type [`content`](https://github.com/75lb/command-line-usage/blob/master/doc/api.md#module_command-line-usage--commandLineUsage..content) or [`optionList`](https://github.com/75lb/command-line-usage/blob/master/doc/api.md#module_command-line-usage--commandLineUsage..optionList). This section data is passed to [`commandLineUsage()`](https://github.com/75lb/command-line-usage/blob/master/doc/api.md#exp_module_command-line-usage--commandLineUsage) which returns a usage guide.\n\nInline ansi formatting can be used anywhere within section content using [chalk template literal syntax](https://github.com/chalk/chalk/tree/v2.4.2#tagged-template-literal).\n\nFor example, this script:\n```js\nimport commandLineUsage from 'command-line-usage'\n\nconst sections = [\n  {\n    header: 'A typical app',\n    content: 'Generates something {italic very} important.'\n  },\n  {\n    header: 'Options',\n    optionList: [\n      {\n        name: 'input',\n        typeLabel: '{underline file}',\n        description: 'The input to process.'\n      },\n      {\n        name: 'help',\n        description: 'Print this usage guide.'\n      }\n    ]\n  }\n]\nconst usage = commandLineUsage(sections)\nconsole.log(usage)\n```\n\nOutputs this guide:\n\n\u003cimg src=\"https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/synopsis.png\" width=\"90%\"\u003e\n\n## Some examples\n\n### Typical\n\nA fairly typical usage guide with three sections - description, option list and footer. [Code](https://github.com/75lb/command-line-usage/wiki/How-to-create-a-typical-usage-guide).\n\n\u003cimg src=\"https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/simple.png\" width=\"90%\"\u003e\n\n### Option List groups\n\nDemonstrates breaking the option list up into groups. [Code](https://github.com/75lb/command-line-usage/wiki/How-to-break-the-option-list-up-into-groups).\n\n\u003cimg src=\"https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/groups.png\" width=\"90%\"\u003e\n\n### Banners\n\nA banner is created by adding the `raw: true` property to your `content`. This flag disables any formatting on the content, displaying it raw as supplied.\n\n#### Header\n\nDemonstrates a banner at the top. This example also adds a `synopsis` section. [Code](https://github.com/75lb/command-line-usage/wiki/How-to-add-a-banner-to-your-usage-guide#code).\n\n\u003cimg src=\"https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/header.png\" width=\"90%\"\u003e\n\n#### Footer\n\nDemonstrates a footer banner. [Code](https://github.com/75lb/command-line-usage/wiki/How-to-add-a-banner-to-your-usage-guide#code-1).\n\n\u003cimg src=\"https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/footer.png\" width=\"90%\"\u003e\n\n### Examples section (table layout)\n\nAn examples section is added. To achieve this table layout, supply the `content` as an array of objects. The property names of each object are not important, so long as they are consistent throughout the array. [Code](https://github.com/75lb/command-line-usage/wiki/How-to-add-an-examples-section-to-your-usage-guide).\n\n\u003cimg src=\"https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/example-columns.png\" width=\"90%\"\u003e\n\n### Advanced optionList layout\n\nThe `optionList` layout is fully configurable by setting the `tableOptions` property with an options object suitable for passing into [table-layout](https://github.com/75lb/table-layout#table-). This example overrides the default column widths and adds flame padding. [Code](https://github.com/75lb/command-line-usage/wiki/How-to-use-advanced-optionList-table-formatting).\n\n\u003cimg src=\"https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/option-list-options.png\" width=\"90%\"\u003e\n\n### Command list\n\nUseful if your app is command-driven, like git or npm. [Code](https://github.com/75lb/command-line-usage/wiki/How-to-add-a-command-list-to-your-usage-guide).\n\n\u003cimg src=\"https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/command-list.png\" width=\"90%\"\u003e\n\n### Description section (table layout)\n\nDemonstrates supplying specific [table layout](https://github.com/75lb/table-layout) options to achieve more advanced layout. In this case the second column (containing the hammer and sickle) has a fixed `width` of 40 and `noWrap` enabled (as the input is already formatted as desired). [Code](https://github.com/75lb/command-line-usage/wiki/How-to-add-a-description-section-to-your-usage-guide).\n\n\u003cimg src=\"https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/description-columns.png\" width=\"90%\"\u003e\n\n### Real-life\n\nThe [polymer-cli](https://github.com/Polymer/tools/tree/master/packages/cli) usage guide is a good real-life example.\n\n\u003cimg src=\"https://raw.githubusercontent.com/75lb/command-line-usage/master/example/screens/polymer.png\" width=\"90%\"\u003e\n\n## Documentation\n\n* [API Reference](https://github.com/75lb/command-line-usage/blob/master/doc/api.md)\n* [The full list of examples](https://github.com/75lb/command-line-usage/wiki)\n\n* * *\n\n\u0026copy; 2015-24 Lloyd Brookes \\\u003c75pound@gmail.com\\\u003e. Documented by [jsdoc-to-markdown](https://github.com/75lb/jsdoc-to-markdown).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F75lb%2Fcommand-line-usage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F75lb%2Fcommand-line-usage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F75lb%2Fcommand-line-usage/lists"}