Skip to content
This repository was archived by the owner on Jun 16, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ Wilfred is a simple [boilerplate](https://en.wikipedia.org/wiki/Boilerplate_code

`npm install -g wilfred`

**Optional:**

To use autocompletion on Wilfred, add the following lines to your ~/.bash_profile or ~/.zshrc.

```bash
if [ -f $(npm root -g)/wilfred/autocomplete/wilfred-completion.bash ]; then
. $(npm root -g)/wilfred/autocomplete/wilfred-completion.bash
fi
```

## Usage

For more information on how to use wilfred run `wilfred --help`
Expand All @@ -21,11 +31,10 @@ For more information on how to use wilfred run `wilfred --help`
- [x] Local folders
- [x] Interactive and non-interactive mode<sup>[1](#footnote1)</sup>
- [x] `.wilfredhook` for running commands after copy
- [x] Bash autocomplete
- [ ] GitHub support
- [ ] `.wilfredignore` for files to ignore during copy (maybe?)
- [ ] Bash autocomplete

<sub><sup><a name="footnote1">1</a>: If you pass in the boilerplate name as argument it will run non-interactive. If you don't it will run in interactive mode.</sup></sub>

## Changelog

Expand Down
31 changes: 31 additions & 0 deletions autocomplete/wilfred-completion.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# bash/zsh provider completion support for wilfred
#
# Usage:
#
# 1. Have wilfred installed and do `npm install -g root`.
# 2. Add the following lines to .bash_profile or .zshrc
#
# if [ -f $(npm root -g)/wilfred/autocomplete/wilfred-completion.bash ]; then
# . $(npm root -g)/wilfred/autocomplete/wilfred-completion.bash
# fi

if [[ -n ${ZSH_VERSION-} ]]; then
autoload -U +X compinit && compinit
autoload -U +X bashcompinit && bashcompinit
fi

_wilfred_completion()
{
local cur=${COMP_WORDS[COMP_CWORD]}
local prev=${COMP_WORDS[COMP_CWORD-1]}
local IFS=$'\n'

if [[ "$prev" == "wilfred" ]]; then
# Get all boilerplates using `wilfred -l`
COMPREPLY=( $(compgen -W "$(wilfred -l | awk '{print $1;}')" -- $cur) )
fi

}
complete -o filenames -F _wilfred_completion wilfred