https://github.com/rakshasa/bash-completion-template
Bash completion template
https://github.com/rakshasa/bash-completion-template
Last synced: 2 months ago
JSON representation
Bash completion template
- Host: GitHub
- URL: https://github.com/rakshasa/bash-completion-template
- Owner: rakshasa
- Created: 2019-11-02T21:21:31.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-11-25T14:47:38.000Z (over 5 years ago)
- Last Synced: 2025-02-01T06:27:06.365Z (4 months ago)
- Language: Shell
- Size: 24.4 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Bash Completion Template
========================Introduction
------------This project provides a template for creating bash completion scripts
that support nested command namespaces.Getting Started
---------------Copy the `template.bash` file and replace `{{bc_namespace}}`, `{{bc_executable}}` and
`{{bc_command}}`. Add your changes above the `# completion function`
line so that the scripts for importing from and updating the template
works correctly.```bash
touch ~/rtorrent-docker/misc/rtorrent-docker.bash
/update rtorrent_docker rt_do "rt-do rt-do.exe" ~/rtorrent-docker/misc/rtorrent-docker.bash
```Update your file with the latest changes to `template.bash`.
```bash
./import ~/rtorrent-docker/misc/rtorrent-docker.bash
```Update `template.bash` with changes made to your file below the `#
completion function` line.Template Placeholders
---------------------```bash
{{bc_namespace}} # all bash functions are prepended with "_{{bc_namespace}}_"
{{bc_executable}} # the filename of the executable binary
{{bc_command}} # the bash-friendly name appended to the namespace
```Helper Functions
----------------```bash
# arg_funcs+=(--foo##skip)
# arg_funcs+=(--foo#_bazspace__skip)
# arg_funcs+=(--foo##compgen#-o#default)
```Adds a handler for the flag `--foo` so it calls `_bazspace__skip`, with `##` adding the namespace prefix and subsequent `#` adding arguments.