{"id":16096324,"url":"https://github.com/sio/bash-complete-partial-path","last_synced_at":"2025-07-02T06:04:47.551Z","repository":{"id":45353146,"uuid":"141112366","full_name":"sio/bash-complete-partial-path","owner":"sio","description":"Enhanced file path completion in bash (like in zsh) ","archived":false,"fork":false,"pushed_at":"2025-04-11T15:35:39.000Z","size":158,"stargazers_count":59,"open_issues_count":7,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-06-14T09:04:33.302Z","etag":null,"topics":["bash","cli","completion","shell"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sio.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-07-16T08:51:11.000Z","updated_at":"2025-04-30T16:36:29.000Z","dependencies_parsed_at":"2024-10-26T19:31:22.224Z","dependency_job_id":"7c51399d-5c80-422e-9f18-520343dabf8c","html_url":"https://github.com/sio/bash-complete-partial-path","commit_stats":{"total_commits":201,"total_committers":2,"mean_commits":100.5,"dds":0.00995024875621886,"last_synced_commit":"a498597628c5fb52e8665cb65b6fd29fc429db24"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/sio/bash-complete-partial-path","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sio%2Fbash-complete-partial-path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sio%2Fbash-complete-partial-path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sio%2Fbash-complete-partial-path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sio%2Fbash-complete-partial-path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sio","download_url":"https://codeload.github.com/sio/bash-complete-partial-path/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sio%2Fbash-complete-partial-path/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263083593,"owners_count":23411163,"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","cli","completion","shell"],"created_at":"2024-10-09T17:13:21.343Z","updated_at":"2025-07-02T06:04:47.514Z","avatar_url":"https://github.com/sio.png","language":"Python","readme":"# Enhanced file path completion in bash\n\nThis project adds incomplete file path expansion to bash (the feature that was\noriginally unique to zsh).\n\nWhen the Tab key is pressed bash expands only the last piece of the path by\ndefault, but with the completion functions from this project it will assume any\nof path elements might be incomplete. For example: `cd /u/s/app\u003cTab\u003e` will\nproduce nothing by default, but will be expanded to `cd /usr/share/applications`\nif you've configured bash to load this file.\n\nIntroductory overview is available at\n[author's blog](https://potyarkin.com/posts/2018/enhanced-file-path-completion-in-bash-like-in-zsh/).\n\nWatch a demo screencast to see this feature in action:\n\n[![asciicast](https://asciinema.org/a/191776.svg)](https://asciinema.org/a/191776)\n\nTo enable the described behavior source [**this file**][main] from your\n~/.bashrc and run `_bcpp --defaults`. Supported features are:\n\n- Special characters in completed path are automatically escaped if present\n- Tilde expressions are properly expanded (as per [bash documentation])\n- If user had started writing the path in quotes, no character escaping is\n  applied. Instead the quote is closed with a matching character after expanding\n  the path.\n- If [bash-completion] package is already in use, this code will safely override\n  its `_filedir` function. No extra configuration is required, just make sure\n  you source this project *after* the main bash-completion.\n\nCompletion functions have been tested and reported to work on:\n\n- Linux (Debian 9, 10, 11)\n- macOS (requires gnu-sed from brew)\n- Windows (msys2, Git for Windows)\n\n[Automated tests](tests/README.md) are continuously executed\non Linux, FreeBSD, macOS and Windows (msys2).\n\n\n## Installation and updating\n\nFirst you need to copy [bash_completion][main] file to your machine.  Copy and\npaste the following commands into your terminal to fetch the latest version of\nthe script to the default location (requires `curl` to be installed).\n\n```shell\n# Install or update bash-complete-partial-path\nmkdir -p \"$HOME/.config/bash-complete-partial-path/\" \u0026\u0026 \\\ncurl \\\n -o \"$HOME/.config/bash-complete-partial-path/bash_completion\" \\\n \"https://raw.githubusercontent.com/sio/bash-complete-partial-path/stable/bash_completion\"\n```\n\nTo enable the new completion behavior put the following lines into your\n`~/.bashrc` (or your OS equivalent).\n\n```shell\n# Enhanced file path completion in bash - https://github.com/sio/bash-complete-partial-path\nif [ -s \"$HOME/.config/bash-complete-partial-path/bash_completion\" ]\nthen\n    source \"$HOME/.config/bash-complete-partial-path/bash_completion\"\n    _bcpp --defaults\nfi\n```\n\nMake sure you source this project *after* the main bash-completion which may be\nincluded in your  `~/.bashrc` file.\n\n\n## Runtime requirements\n\nTo use this completion script make sure your OS provides the following\ndependencies:\n\n- GNU Bash, version 4 or newer (version 3.2 is not yet supported, see\n  [#8](https://github.com/sio/bash-complete-partial-path/issues/8))\n- GNU Sed (install it with brew on macOS)\n- Core unix-like userland (mktemp, mkfifo, rm)\n\n\n## Custom feature selection\n\nIf you like the project idea overall but do not agree with default behavior,\nyou can select which features to enable with `_bcpp` manager function. Sourcing\nthe file without calling this function has no side effects.\n\n```\nUsage: _bcpp OPTIONS\n    Manage enhanced path completion in bash\n\nOptions:\n    --defaults\n        Enable the subset of features recommended by maintainer.\n        Currently equals to:\n        \"--files --dirs --cooperate --nocase --readline\"\n    --all\n        Enable all optional features. Equals to:\n        \"--files --dirs --cooperate --nocase --readline\"\n    --help\n        Show this help message\n\nIndividual feature flags:\n    --files\n        Enable enhanced completion for file paths\n    --dirs\n        Complete `cd` with paths to directories only\n    --cooperate\n        Cooperate with system-wide bash-completion if it's in use.\n        This function must be invoked AFTER the main bash-completion\n        is loaded.\n        Deprecated alias: --override\n    --nocase\n        Make path completion case insensitive\n    --readline\n        Configure readline for better user experience. Equals to:\n        \"--readline-menu --readline-color --readline-misc\"\n    --readline-color\n        Enable colors in completion\n    --readline-menu\n        Use `menu-complete` when Tab key is pressed instead of default\n        `complete`. Use Shift+Tab to return to previous suggestion\n    --readline-misc\n        Other useful readline tweaks\n```\n\n\n## Working together with other completion scripts\n\nPartial path completion provided by this project is designed to work correctly\nwhen [bash-completion] is in use (see `--cooperate` flag). Make sure you\ninvoke `_bcpp` after the main completion script has been sourced.\n\nEnhanced completion will work for most, but not all commands unfortunately.\nSome completion scripts within [bash-completion] project do not rely on global\n`_filedir*` functions but instead implement their own logic for path\ncompletion. For such scripts there is no simple way to inject modified\ncompletion algorithm without disabling the rest of their functionality.\n\nIf for any particular command you'll prefer partial path completion over its\nprovided completion script, you can run `complete -F _bcpp_complete_file\nCOMMANDNAME` (and/or add that to ~/.bashrc)\n\n\n## Support\n\n#### Issue tracker\n\nGitHub's [issue tracker] is the primary venue for asking and answering support\nquestions. Please don't forget to search closed issues for the topic you're\ninterested in!\n\nIf you know an answer to the question asked by someone else, please do not\nhesitate to post it! That would be a great help to the project!\n\n#### Email\n\nIf for some reason you'd rather not use the [issue tracker], contacting me via\nemail is OK too. Please use a descriptive subject line to enhance visibility\nof your message. Also please keep in mind that support through the channels\naccessible to the public is preferable because one answer can help many people\nwho might read it later.\n\nMy email is visible under the GitHub profile and in the commit log.\n\n#### Community support\n\nYou might get faster and more interactive support from other users.\n\nThis project does not (yet) have a dedicated community venue, but experienced\nLinux users will most likely be able to figure out most common questions. You\ncan try asking at the local Linux-related forums, IRC/Discord/Telegram chats\nor on Reddit/StackOverflow.\n\n\n## Contributing\n\nThank you for taking an interest in this project! If you wish to improve it\nplease open an issue or create a pull request.\nIf you just want to share your emotions, we encourage you to do so\n[here](https://github.com/sio/bash-complete-partial-path/issues/6)!\n\nYour help is most needed in the following areas:\n\n- Documenting the project\n- Finding (and fixing) existing bugs\n- Testing the script on other operating systems and reporting the results (both\n  positive and negative)\n- Expanding OS support (if it's lacking)\n- Adding better demo asciicasts and screenshots\n\nThe project was created to do one thing (autocomplete partial paths) and to do\nit well. Please try to keep all code in one file and to keep it short. Major new\nfunctionality is probably better suited for a separate project.\n\nI'm open to dialog and I promise to behave responsibly and treat all\ncontributors with respect. Please try to do the same, and treat others the way\nyou want to be treated.\n\nThank you again!\n\n\n## Information for developers\n\n#### Debugging\n\nExecuting `set -v; set -x` before attempting completion enables printing a lot\nof useful debugging information\n\n#### Automated testing\n\nTests are implemented with Python and Pexpect. [Read more here](tests/README.md)\n\n\n## License and copyright\n\nCopyright © 2018-2019 Vitaly Potyarkin\n\n```\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use these files except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n```\n\n[bash-completion]: https://github.com/scop/bash-completion\n[bash documentation]: https://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html\n[main]: bash_completion\n[issue tracker]: https://github.com/sio/bash-complete-partial-path/issues\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsio%2Fbash-complete-partial-path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsio%2Fbash-complete-partial-path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsio%2Fbash-complete-partial-path/lists"}