{"id":14982909,"url":"https://github.com/loilo/completarr","last_synced_at":"2025-04-13T21:40:36.510Z","repository":{"id":57204672,"uuid":"142933268","full_name":"loilo/completarr","owner":"loilo","description":"Zero config autocompletions for yargs apps (bash, zsh, fish)","archived":false,"fork":false,"pushed_at":"2019-06-05T09:43:52.000Z","size":30,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T18:05:37.924Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/loilo.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}},"created_at":"2018-07-30T22:11:48.000Z","updated_at":"2020-05-16T14:41:07.000Z","dependencies_parsed_at":"2022-09-18T00:42:01.748Z","dependency_job_id":null,"html_url":"https://github.com/loilo/completarr","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fcompletarr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fcompletarr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fcompletarr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loilo%2Fcompletarr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loilo","download_url":"https://codeload.github.com/loilo/completarr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788859,"owners_count":21161726,"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-09-24T14:06:23.855Z","updated_at":"2025-04-13T21:40:36.487Z","avatar_url":"https://github.com/loilo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Completarr\n\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n[![npm](https://img.shields.io/npm/v/completarr.svg)](https://www.npmjs.com/package/completarr)\n\nCompletarr is a zero config way to add shell auto completion for your [yargs](https://yargs.js.org)-based CLI applications.\n\nYou may want to use this over yargs' [built-in solution](http://yargs.js.org/docs/#api-completioncmd-description-fn) if you need to support a wider range of shells (including zsh and fish).\n\n## Installation\n```\nnpm install --save completarr\n```\n\n## Usage\nTo use Completarr, perform the following rather simple steps:\n\n1. Integrate it into your CLI app:\n\n   ```javascript\n   require('completarr')()\n\n   // Your yargs-related code\n   ```\n2. Add install/uninstall hooks to your `package.json` to automatically attach the completion script the user's shell init file:\n\n   ```json\n   {\n     \"scripts\": {\n       \"postinstall\": \"install-yargs-completion\",\n       \"uninstall\": \"uninstall-yargs-completion\"\n     }\n   }\n   ```\n\n### Caveats\nThere are some things to consider:\n\n* Completarr is based on [omelette](https://github.com/f/omelette) and therefore does not support Windows. 😕\n* Completarr only works with globally installed commands.\n* Your yargs app needs to expose its help via [`.help()`](http://yargs.js.org/docs/#api-help) to make Completarr work.\n\n### Configuration\nCompletarr should work without any config 99% of the time, but there might be some edge cases in your app you want to handle:\n\n#### Command Name (Shell Script)\nBy default, Completarr adds completion for all commands it finds in your `package.json`'s `bin` field. If you got more commands there than you want completion for, you need to pass them to the install/uninstall hook explicitely:\n\n```javascript\n// Your CLI app's package.json\n{\n  // We got three binaries:\n  \"bin\": {\n    \"a\": \"./src/a\",\n    \"b\": \"./src/b\"\n    \"c\": \"./src/c\"\n  },\n  \"scripts\": {\n    // But we only want to install completions for \"b\" and \"c\":\n    \"postinstall\": \"install-yargs-completion b c\",\n    \"uninstall\": \"uninstall-yargs-completion b c\"\n  }\n}\n```\n\n#### Command Name (Node)\nCompletarr needs to know the name of your yargs root command to provide completions. By default it derives that from the binary where Completarr is included:\n\n```javascript\n// file: src/hello\nrequire('completarr')()\n\n// Completarr assumes the command name is \"hello\"\n```\n\nHowever if for some reason your command name does not equal your file's name, you may pass Completarr the command name manually:\n\n```javascript\n// file: src/foo.js\nrequire('completarr')({\n  name: 'hello'\n})\n```\n\n#### Help Option\nBy default, yargs' option for showing the help output is `--help`. However, should you decide to publish the help under a different option ([which yargs allows you to do](http://yargs.js.org/docs/#api-helpoption-boolean)) you'll have to tell Completarr about it:\n\n```javascript\n// We use --info instead of --help\nrequire('completarr')({\n  helpOption: 'info'\n})\n\n// yargs-related code\nrequire('yargs')\n  .help('info')\n  // ...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floilo%2Fcompletarr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floilo%2Fcompletarr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floilo%2Fcompletarr/lists"}