-
-
Notifications
You must be signed in to change notification settings - Fork 245
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
[feature] Shell completion #515
Comments
Like this: #compdef insights
if ((${${words[1, CURRENT - 1]}[(I)--]})); then # insights -- <TAB>
service=clang _gcc
else # insights <TAB> or insights <TAB> --
local options=(
--alt-syntax-for"[Transform all for-loops into their equivalent while-loop]"
--alt-syntax-subscription"[Transform array subscriptions E1(E2) into (*(E1 + E2))]"
--extra-arg"[Additional argument to append to the compiler command line]:string"
--extra-arg-before"[Additional argument to prepend to the compiler command line]:string"
"(- : *)"-h"[Alias for --help]"
"(- : *)"--help"[Display available options (--help-hidden for more)]"
"(- : *)"--help-hidden"[Display all available options]"
"(- : *)"--help-list"[Display list of available options (--help-list-hidden for more)]"
"(- : *)"--help-list-hidden"[Display list of all available options]"
-p"[Build path]: :_files"
"(- : *)"--print-all-options"[Print all option values after command line parsing]"
"(- : *)"--print-options"[Print non-default options after command line parsing]"
--show-all-implicit-casts"[Show all implicit casts which can be noisy]"
--stdin"[Override source file's content (in the overlaying virtual file system) with input from <stdin> and run the tool on the new content with the compilation options of the source file]"
--use-libc++"[Use libc++]"
--version"[Display the version of this program]"
--
)
_arguments -s $options
fi
|
Hello @Freed-Wu, that is an interesting request. It looks like you also already presented a solution. All C++ Insights options are defined here InsightsOptions.def. An automatic update of the shell completion script would be nice for future updates. There is a build step that uses OptionDocumentationGenerator.cpp. Currently, the program generates markdown files. I could imagine that it generates the completion script in addition to the markdown. Or of course, a data structure read by a completion template. How do you think the completion script should be distributed? Andreas |
Do you means install this completion script? https://github.com/lyokha/g3kb-switch/blob/master/CMakeLists.txt#L39-L45 should be a reference. (Although their shell completion script is written manually.) |
Hello @Freed-Wu
sorry, I was imprecise. I meant where to store it. Only in git or also as part of the release download. Andreas |
The packagers of distributions usually build the package ( However, if you provide a pre-build shell completion scripts (such as create it by CI/CD then publish it in github release) is also OK. |
Hello @Freed-Wu, thanks for sharing this. I'm looking for a way to reach people with the completion script. Since I'm not creating a package (at the moment), I'm looking for a way to make the script easily accessible. I have to think about this a bit more. Andreas |
Is it possible to provide completion for common shells (bash, zsh, ...)? TIA!
The text was updated successfully, but these errors were encountered: