-
-
Notifications
You must be signed in to change notification settings - Fork 757
completion/makefile: Discover targets and vars, print colored results #724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
completion/makefile: Discover targets and vars, print colored results #724
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||
84d53f9 to
fa9f5f2
Compare
Parse Makefiles to extracts targets and vars, incl. descriptions. Show targets on first tab press and usage info on multiple tab presses.
fa9f5f2 to
e59426a
Compare
Detect dir and file from -C and -f. Respect dir in include search. Add file completion fallback. Add more std. make flags.
User description
Changes
Makefilescraping to extract targets and vars, incl. descriptionsincludefilesUsage
Example
Makefile Structure:
Makefile content:
Included content:
Example Output:
1st
<tab>press on query "ai"2nd
<tab>press on query "ai"Approach
*makefileincludefilesquery<tab><tab><tab>tracking after 10sTechnologies
awkwhere possible_omb_term_*colorsgrep,echo,sort,uniqmake, since this can have side effectsTests
Tested on two multi-file Makefile projects with
includefiles. \OS: Ubuntu LTS 2024
Arch: AMD64
Bash: GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu)
Tests:
make <tab>-> shows short listmake <tab> <tab>-> shows extracted, colored usage infomake unknown <tab>-> does not show anything and does not break the promptmake partial <tab>-> shows short list forpartial*make partial <tab> <tab>-> shows usage forpartial*make var_ <tab>-> shows vars and targetsVAR_*orvar_*make var_ <tab> <tab>-> shows vars and targets and usagemake var_ab <tab>(1 match) -> completes and does not break promptmake - <tab>shows common make flagsmake - <tab> <tab>shows common make flags and usage info (incl.--helpto indicate further help)make --<flag> <tab>shows long and short flagmake --<flag> <tab> <tab>shows long and short flag and usagePR Type
Enhancement
Description
Rewrote makefile completion to extract targets, variables, and descriptions
Added support for included
.mkfiles with recursive discoveryImplemented tab press tracking to show descriptions on repeated Tab presses
Added colorized output using terminal color variables for better readability
Replaced simple regex with comprehensive AWK-based parsing for robust extraction
Diagram Walkthrough
File Walkthrough
makefile.completion.sh
Complete rewrite of makefile completion with descriptionscompletions/makefile.completion.sh
completecommand with comprehensive 370-linecompletion module
targets/variables
detailed descriptions
_omb_term_*color variablesguidelines
-h,-B,-n,-C,-f,-E) withdescriptions