Closed yoavnir closed 2 months ago
How it's done:
bashrc
should call complete -C specs-autocomplete specs
specs-autocomplete
in the path.argc
is always 4. Exit if not.argv[1]
is the command, usually specs
argv[2]
is what we're completing - can be an empty string after a space, or whatever we have typed since the last space.argv[3]
The previous wordCOMP_LINE
contains all of the stuff on the commad lineCOMP_POINT
contains the offset (stringified integer) within the line where the cursor is. If it's at the end, then atoi(getenv("COMP_POINT")) == strlen(getenv("COMP_LINE"))
COMP_TYPE
has several values:
-f funclnf
and the only specfile that starts with funclnf
is funclnfreq
, the program can output funclnfreq
.-f func
and there are both funclnfreq
and funcfreq
, the program can output funcfreq funclnfreq
.You want to use getFullSpecPath()
to get the path, and then search using std::filesystem
to get all the some of the files.
As long as we're auto-completing (for -f
both from the SPECSPATH and from current directory, for -o
ad -i
only from current directory). But should also consider what has already been typed...
Maybe use this for multi-compare
std::set<std::string> e{"one", "two", "three", "five", "eight"};
Do it all lower-case and convert the prevToken to lowercase before passing it?
I will leave this issue open until I've verified that it works on Ubuntu 24
Specifically:
-f
or--specfile
-i
or--inFile
--is*
-c
or--config