Skip to content

Instantly share code, notes, and snippets.

@vgaicuks
Created March 19, 2019 16:08
Embed
What would you like to do?
Project autocomplete
#!/bin/bash
_projects()
{
local curw
COMPREPLY=()
curw=${COMP_WORDS[COMP_CWORD]}
local projects=$(ls -1 ~/code)
COMPREPLY=($(compgen -W "$projects" -- $curw));
return 0
}
complete -o default -F _projects c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment