By setting the COBRA_FLAG_COMPLETION environment variable, the normal execution path of the command
is short circuited, and instead the function registered by `MarkCustomFlagCompletion` is executed.
All flags other than the one being completed get parsed according to whatever type they are defined
as, but the flag being completed is parsed as a raw string and passed into the custom compeltion.
- Moved some general function to a more generic shell_completions file.
- Added functions to mark flag as directory completion.
- Started making the global functions docs more generic (not bash
specific) and added compatibility matrix.
- If the flags are not bool the completion expects argument.
- You don't have to specify file extensions for file completion to
work.
- Allow multiple occurrences of flag if type is stringArray.
Need to verify that these assumption are correct :)
A very basic POC. Need to refactor to generate completion
structure before passing to the template to avoid repeated
computations.
What works:
* Real zsh completion (not built on bash)
* Basic flags (with long flag and optional shorthand)
* Basic filename completion indication (not with file extensions though)
What's missing:
* File extensions to filename completions
* Positional args
* Do we require handling only short flags?