-
Notifications
You must be signed in to change notification settings - Fork 2
Add zsh completion script #1
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: main
Are you sure you want to change the base?
Conversation
| "-h" "-hh" "--help" "-V" "--version" "-q" "--quiet" "-v" "-vv" "-vvv" "-E" "-P" "-C" "-" | ||
| "-o" "-O0" "-O1" "-O2" "-O3" "-O4" "-O5" "-Os" "-Oz" "-D" "-U" "--about" "--build-env" | ||
| "--run-dir" "--libdir" "--lib" "--sources" "--validation=" "--stdlib" "--no-entry" "--path" | ||
| "--template" "--symtab" "--run-once" "--suppress-run" "--trust=" "--output-dir" "--build-dir" | ||
| "--obj-out" "--script-dir" "--llvm-out" "--asm-out" "--header-output" "--emit-llvm" "--emit-asm" | ||
| "--obj" "--no-obj" "--no-headers" "--target" "--threads" "--safe=" "--panic-msg=" "--optlevel=" | ||
| "--optsize=" "--single-module=" "--show-backtrace=" "--lsp" "--use-old-slice-copy" "-g" "-g0" | ||
| "--ansi=" "--test-filter" "--test-breakpoint" "--test-nosort" "--test-noleak" "--test-nocapture" | ||
| "--test-quiet" "-l" "-L" "-z" "--cc" "--linker=" "--use-stdlib=" "--link-libc=" "--emit-stdlib=" | ||
| "--panicfn" "--testfn" "--benchfn" "--reloc=" "--x86cpu=" "--x86vec=" "--riscvfloat=" | ||
| "--memory-env=" "--strip-unused=" "--fp-math=" "--win64-simd=" "--win-debug=" "--max-vector-size" | ||
| "--print-linking" "--benchmarking" "--testing" "--list-attributes" "--list-builtins" | ||
| "--list-keywords" "--list-operators" "--list-precedence" "--list-project-properties" | ||
| "--list-manifest-properties" "--list-targets" "--list-type-properties" "--print-output" | ||
| "--print-input" "--winsdk" "--wincrt=" "--windef" "--win-vs-dirs" "--macossdk" | ||
| "--macos-min-version" "--macos-sdk-version" "--linux-crt" "--linux-crtbegin" "--android-ndk" | ||
| "--android-api" "--sanitize=" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put all the flags on a separate line for ease of adding new ones (and slightly automating this with some more advanced vim-editing of c3c --help > help.txt).
Putting all flags on a separate line also helps with git diff.
| "-h" "--help" "-v" "-vv" "--authors" "--version" "--language-revision" "--warnings-used" | ||
| "--c3l-lib-search-paths" "--c3l-lib-dependencies" "--source-paths" "--output-location" | ||
| "--default-optimization" "--targets" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idem.
| c3c) | ||
| if [[ "${cur}" == -* ]]; then | ||
| _complete_options "${cur}" "${options[*]}" | ||
| else | ||
| _complete_options "${cur}" "${commands[*]} -" | ||
| fi | ||
| return | ||
| ;; | ||
| project) | ||
| _complete_options "${cur}" "view add-target fetch" | ||
| return | ||
| ;; | ||
| build|run|dist|directives|bench|clean-run) | ||
| local project_targets=$(c3c project view --targets 2>/dev/null) | ||
| _complete_options "${cur}" "${project_targets}" | ||
| return | ||
| ;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update the c3c and build|run|dist|... to work like the updated bash version?
The difference is that - changed to -... to better signify that it's a placeholder for all the flags, and the return disappears to allow for the space to be stripped behind = (although this currently does not work with this zsh script), and the completions for build|run|dist|... got a bit smarter by allowing the flags there too.
| fi | ||
|
|
||
| if [[ "${#COMPREPLY[@]}" -eq 1 && "${COMPREPLY[0]}" == *= ]]; then | ||
| compopt -o nospace 2>/dev/null || : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this compopt -o nospace work? That might be the key to behave the same way as the bashscript (allowing completions like yes or no for flags like --safe=).
|
Lastly, could you update the README for small instruction on how to load it for zsh please? Thank you for all your work! |
|
I found a small workaround for when the |
|
i'll give it a try later |
|
i forgor |
No description provided.