Skip to content

Conversation

@FoxKiana
Copy link

No description provided.

Comment on lines +38 to +54
"-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="
Copy link
Owner

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.

Comment on lines +58 to +60
"-h" "--help" "-v" "-vv" "--authors" "--version" "--language-revision" "--warnings-used"
"--c3l-lib-search-paths" "--c3l-lib-dependencies" "--source-paths" "--output-location"
"--default-optimization" "--targets"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem.

Comment on lines +68 to +84
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
;;
Copy link
Owner

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 || :
Copy link
Owner

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=).

@BWindey
Copy link
Owner

BWindey commented Jun 10, 2025

Lastly, could you update the README for small instruction on how to load it for zsh please?

Thank you for all your work!

@BWindey
Copy link
Owner

BWindey commented Jul 8, 2025

I found a small workaround for when the compopt -o nospace has no zsh-equivalent: write down all flags inside the options array, so both --safe=yes and --safe=no are inside that array. Then the only "trick" needed is to remove = form wordbreaks (maybe that is default in zsh?).

@FoxKiana
Copy link
Author

i'll give it a try later

@FoxKiana
Copy link
Author

i forgor

@BWindey BWindey mentioned this pull request Aug 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants