Created
August 3, 2024 18:03
-
-
Save ericpardee/cd6dbcad17a8d269c34a3a0772f424cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Define make completions | |
function _make_completions() { | |
local -a targets | |
if [[ -f 'Makefile' ]]; then | |
# Read targets from Makefile using Extended Regular Expressions | |
# This regex aims to match any target that does not start with a dot and includes more characters than before. | |
targets=($(grep -oE '^[^\.#][^ ]*:' Makefile | sed 's/:.*//')) | |
fi | |
# Define completions based on targets | |
_describe 'target' targets | |
} | |
# Tell Zsh to use this function for make completion | |
compdef _make_completions make |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment