{"id":16191948,"url":"https://github.com/muniftanjim/oclif-plugin-completion","last_synced_at":"2025-03-19T03:31:03.992Z","repository":{"id":38426849,"uuid":"266705855","full_name":"MunifTanjim/oclif-plugin-completion","owner":"MunifTanjim","description":"oclif plugin for generating shell completions","archived":false,"fork":false,"pushed_at":"2023-02-16T19:32:39.000Z","size":133,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-17T03:21:45.821Z","etag":null,"topics":["bash","fish","oclif","oclif-plugin","shell","shell-completion","zsh"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/MunifTanjim.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2020-05-25T06:52:48.000Z","updated_at":"2024-01-29T05:02:14.000Z","dependencies_parsed_at":"2023-11-17T00:11:48.065Z","dependency_job_id":"2353d265-a5d7-4bd5-a72f-f909aeb8c0c5","html_url":"https://github.com/MunifTanjim/oclif-plugin-completion","commit_stats":{"total_commits":32,"total_committers":2,"mean_commits":16.0,"dds":0.0625,"last_synced_commit":"b1f524250026db0e21112411c802e57319e235dc"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MunifTanjim%2Foclif-plugin-completion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MunifTanjim%2Foclif-plugin-completion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MunifTanjim%2Foclif-plugin-completion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MunifTanjim%2Foclif-plugin-completion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MunifTanjim","download_url":"https://codeload.github.com/MunifTanjim/oclif-plugin-completion/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244350987,"owners_count":20439291,"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":["bash","fish","oclif","oclif-plugin","shell","shell-completion","zsh"],"created_at":"2024-10-10T08:07:59.554Z","updated_at":"2025-03-19T03:31:03.747Z","avatar_url":"https://github.com/MunifTanjim.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![oclif Plugin](https://img.shields.io/badge/oclif-plugin-brightgreen?style=for-the-badge)](https://oclif.io)\n[![Version](https://img.shields.io/npm/v/oclif-plugin-completion?style=for-the-badge)](https://npmjs.org/package/oclif-plugin-completion)\n[![License](https://img.shields.io/npm/l/oclif-plugin-completion?style=for-the-badge)](https://github.com/MunifTanjim/oclif-plugin-completion/blob/master/LICENSE)\n\n# oclif Plugin: completion\n\noclif plugin for generating shell completions\n\n\u003c!-- toc --\u003e\n\n- [oclif Plugin: completion](#oclif-plugin-completion)\n- [Completion Features](#completion-features)\n- [Supported Shells](#supported-shells)\n- [Commands](#commands)\n\u003c!-- tocstop --\u003e\n\n# Completion Features\n\nConsider the following `dummy` CLI:\n\n```sh\nUsage: dummy \u003cCOMMAND\u003e [OPTION...]\n\nCommands:\n\n  open   \u003cro|rw\u003e      open a dummy (as read-only or read-write)\n  save                save a dummy\n  search              search a dummy\n\nOptions (open):\n\n  -i, --id            dummy id\n  -f, --file          path to dummy file\n  -d, --dir           path to dummy directory (default: ./dummies)\n  -v, --verbose       boolean flag\n\nOptions (save):\n\n  -n, --name          dummy name\n  -a, --age           dummy age\n  -t, --tag           dummy tag, can be multiple (a/b/c/d)\n  -f, --file          path to dummy file\n  -d, --dir           path to dummy directory (default: ./dummies)\n  -o, --overwrite     boolean flag\n  -v, --verbose       boolean flag\n\nOptions (search):\n\n  -n, --name          dummy name\n  -a, --age           dummy age\n  -t, --tag           dummy tag, can be multiple (a/b/c/d)\n  -v, --verbose       boolean flag\n```\n\nRunning on the current directory with tree:\n\n```sh\n|- dir-one/\n|  |- 042.dummy-with-id-042.json\n|- dir-two/\n|- dummies/\n|  |- 109.dummy-with-id-109.json\n|  |- 110.dummy-with-id-110.json\n|  |- 111.dummy-with-id-111.json\n|- file-one.txt\n|- file-two.txt\n```\n\n## Features Description\n\n**File Path completion**:\n\nCompletion will suggest the files on disk matching glob pattern.\n\n**Directory Path completion**:\n\nCompletion will suggest the directories on disk matching glob pattern.\n\n**Dynamic Runtime completion**:\n\nCompletion will generate the suggestion based on state of runtime environment and/or configuration.\n\n## Features Examples\n\n| Feature                    | Input                                | Output                       |\n| -------------------------- | ------------------------------------ | ---------------------------- |\n| File Path completion       | `dummy open --file=./dir/one/\u003cTAB\u003e`  | `042.dummy-with-id-042.json` |\n| Directory Path completion  | `dummy open --dir ./di\u003cTAB\u003e`         | `dir-one dir-two`            |\n| Dynamic Runtime completion | `dummy open --id \u003cTAB\u003e`              | `109 110 111`                |\n| Dynamic Runtime completion | `dummy open -d ./dir-one --id \u003cTAB\u003e` | `042`                        |\n\n## Feature Support Matrix\n\n| :+1:      | :-1:        | :grey_exclamation: | :bug: | :heavy_check_mark: | :heavy_minus_sign:    | :x:             |\n| --------- | ----------- | ------------------ | ----- | ------------------ | --------------------- | --------------- |\n| Supported | Unsupported | Unknown            | Bug   | Implemented        | Partially Implemented | Not Implemented |\n\n| oclif      | Feature                      | Example                            | Bash                    | Zsh                     | Fish                    |\n| ---------- | ---------------------------- | ---------------------------------- | ----------------------- | ----------------------- | ----------------------- |\n| :+1:       | Positional argument          | `ro`                               | :grey_exclamation: :x:  | :+1: :heavy_check_mark: | :grey_exclamation: :x:  |\n| :+1:       | Basic Long                   | `--name john --age 42 --overwrite` | :+1: :heavy_check_mark: | :+1: :heavy_check_mark: | :+1: :heavy_check_mark: |\n| :+1:       | Alternate Long               | `--name=john --age=42`             | :+1: :heavy_check_mark: | :+1: :heavy_check_mark: | :+1: :heavy_check_mark: |\n| :+1:       | Basic Short                  | `-n john -a 42 -o`                 | :+1: :heavy_check_mark: | :+1: :heavy_check_mark: | :+1: :heavy_check_mark: |\n| :+1:       | Alternative Short            | `-njohn -a42`                      | :+1: :x:                | :+1: :heavy_check_mark: | :+1: :heavy_check_mark: |\n| :+1:       | Stacking Short               | `-ov`                              | :grey_exclamation: :x:  | :+1: :heavy_check_mark: | :+1: :heavy_check_mark: |\n| :+1:       | Stacking Short with argument | `-ova 42`                          | :grey_exclamation: :x:  | :+1: :heavy_check_mark: | :+1: :heavy_check_mark: |\n| :+1:       | Options / Enum               | `--tag a`                          | :+1: :heavy_check_mark: | :+1: :heavy_check_mark: | :+1: :heavy_check_mark: |\n| :+1: :bug: | Multiple                     | `-t c --tag d`                     | :+1: :heavy_minus_sign: | :+1: :heavy_minus_sign: | :+1: :heavy_minus_sign: |\n| :-1:       | File Path completion         | `--file ...`                       | :+1: :heavy_minus_sign: | :+1: :x:                | :+1: :heavy_minus_sign: |\n| :-1:       | Directory Path completion    | `--dir ...`                        | :+1: :heavy_minus_sign: | :+1: :x:                | :+1: :heavy_minus_sign: |\n| :-1:       | Dynamic Runtime completion   | `--dir ./dummies --id 111`         | :+1: :x:                | :+1: :x:                | :+1: :x:                |\n\n# Supported Shells\n\n## Bash\n\nReference: [Bash Completion](https://github.com/scop/bash-completion)\n\nYou need to have `bash-completion` package installed on your system.\n\n### Bash Usage\n\nYou can enable completion for Bash using various methods. A few of them are mentioned below:\n\n**vanilla (.bashrc)**:\n\nAdd the following line in your `.bashrc` file:\n\n```sh\neval \"$(dummy completion:generate --shell bash);\"\n```\n\n**vanilla (completions directory)**:\n\nRun the following command:\n\n```sh\ndummy completion:generate --shell bash | tee ~/.local/share/bash-completion/completions/dummy\n```\n\nDepending on you system, the completion script can also be put into one of these directories:\n\n- `${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion/completions` (linux/macos)\n- `/usr/local/share/bash-completion/completions` (macos)\n- `/usr/share/bash-completion/completions` (linux)\n\n## Zsh\n\nReference: [Zsh Completion System](http://zsh.sourceforge.net/Doc/Release/Completion-System.html)\n\n### Zsh Usage\n\nYou can enable completion for Zsh using various methods. A few of them are mentioned below:\n\n**vanilla (.zshrc)**:\n\nAdd the following line in your `.zshrc` file:\n\n```sh\neval \"$(dummy completion:generate --shell zsh); compdef _dummy dummy;\"\n```\n\n**vanilla (site-functions directory)**:\n\nRun the following command:\n\n```sh\ndummy completion:generate --shell zsh | tee \"$(echo ${FPATH} | tr ':' '\\n' | grep site-functions | head -n1)/_dummy\"\n```\n\nThe completion script can also be put into one of the directories present in `$FPATH` variable:\n\n```sh\necho $FPATH\n```\n\n[**zinit**](https://github.com/zdharma/zinit):\n\nRun the following commands:\n\n```sh\ndummy completion:generate --shell zsh \u003e ~/.local/share/zsh/completions/_dummy\nzinit creinstall ~/.local/share/zsh/completions\n```\n\n## Fish\n\nReference: [Fish Completion](https://fishshell.com/docs/current/cmds/complete.html)\n\n### Fish Usage\n\nReference: [Where to put completions](https://fishshell.com/docs/current/index.html#where-to-put-completions)\n\nYou can enable completion for Fish using various methods. A few of them are mentioned below:\n\n**vanilla (completions directory)**:\n\nRun the following command:\n\n```sh\ndummy completion:generate --shell fish | tee ~/.config/fish/completions/dummy.fish\n```\n\n# Commands\n\n\u003c!-- commands --\u003e\n\n- [`dummy completion`](#dummy-completion)\n- [`dummy completion:generate`](#dummy-completiongenerate)\n- [`dummy completion:generate:alias ALIAS`](#dummy-completiongeneratealias-alias)\n\n## `dummy completion`\n\nGenerate shell completion script\n\n```\nUSAGE\n  $ dummy completion\n\nOPTIONS\n  -s, --shell=bash|fish|zsh  (required) Name of shell\n\nDESCRIPTION\n  Run this command to see instructions for your shell.\n\nEXAMPLE\n  $ dummy completion --shell zsh\n```\n\n_See code: [src/commands/completion/index.ts](https://github.com/MunifTanjim/oclif-plugin-completion/blob/0.6.0/src/commands/completion/index.ts)_\n\n## `dummy completion:generate`\n\nGenerates completion script\n\n```\nUSAGE\n  $ dummy completion:generate\n\nOPTIONS\n  -s, --shell=bash|fish|zsh  (required) Name of shell\n\nDESCRIPTION\n  Run the \"completion\" command to see instructions about how to use the script generated by this command.\n\nEXAMPLE\n  $ dummy completion:generate --shell zsh\n```\n\n_See code: [src/commands/completion/generate/index.ts](https://github.com/MunifTanjim/oclif-plugin-completion/blob/0.6.0/src/commands/completion/generate/index.ts)_\n\n## `dummy completion:generate:alias ALIAS`\n\nGenerates completion script for alias\n\n```\nUSAGE\n  $ dummy completion:generate:alias ALIAS\n\nARGUMENTS\n  ALIAS  name of the alias\n\nOPTIONS\n  -s, --shell=bash|fish  (required) Name of shell\n\nDESCRIPTION\n  This needs the completion script for the main command to be present.\n\n  Check the \"completion:generate\" command.\n```\n\n_See code: [src/commands/completion/generate/alias.ts](https://github.com/MunifTanjim/oclif-plugin-completion/blob/0.6.0/src/commands/completion/generate/alias.ts)_\n\n\u003c!-- commandsstop --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuniftanjim%2Foclif-plugin-completion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuniftanjim%2Foclif-plugin-completion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuniftanjim%2Foclif-plugin-completion/lists"}