Something went wrong. Try again.
Zig bindings for all 506 operations of the Forgejo API, generated from its own description, and zfj, a command line built on them.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100# SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us># SPDX-License-Identifier: MIT
# Each completion script, loaded into its own shell as a person would load# it, completing what a person would type. zfj itself answers for what can# come next (docs/adr/0007-completion-is-answered-by-zfj.md); what this# checks is that each script hands it the line and offers what comes back.{ runCommand, bash, fish, powershell, zsh, zfj,}:runCommand "zfj-completion-check" { nativeBuildInputs = [ bash fish powershell zsh zfj ]; } '' export HOME=$TMPDIR # What a shell offered, one candidate to a line, must include `line`. offered() { local shell=$1 line=$2 file=$3 if ! grep -qxF -- "$line" "$file"; then echo "$shell did not offer '$line'; it offered:" >&2 cat "$file" >&2 exit 1 fi }
fish --no-config -c 'zfj completion fish | source; complete -C "zfj iss"' > fish-command offered fish "$(printf 'issue\twork with issues')" fish-command fish --no-config -c 'zfj completion fish | source; complete -C "zfj issue list --st"' > fish-option offered fish "$(printf -- '--state\twhich issues: open, closed or all')" fish-option fish --no-config -c 'zfj completion fish | source; complete -C "zfj issue list --state c"' > fish-value offered fish closed fish-value
# bash completes through a function given the line as readline splits it, # at `=` as well as at spaces: as here, from the words bash would pass. cat > bash-complete <<'EOF' source <(zfj completion bash) complete_as() { COMP_LINE=$1 COMP_POINT=''${#1} shift COMP_WORDS=("$@") COMP_CWORD=$(($# - 1)) COMPREPLY=() _zfj printf '%s\n' "''${COMPREPLY[@]}" } EOF bash --norc -c 'source bash-complete; complete_as "zfj iss" zfj iss' > bash-command offered bash issue bash-command bash --norc -c 'source bash-complete; complete_as "zfj issue list --st" zfj issue list --st' > bash-option offered bash --state bash-option bash --norc -c 'source bash-complete; complete_as "zfj issue list --state=c" zfj issue list --state = c' > bash-value offered bash closed bash-value
# zsh completes through its completion system, which only an interactive # shell runs: completion.zsh types the line at one and says what it # was offered. zsh-complete() { timeout 60 zsh -f ${./completion.zsh} "$1"; } zsh-complete "zfj iss" > zsh-command offered zsh issue zsh-command zsh-complete "zfj issue list --st" > zsh-option offered zsh --state zsh-option zsh-complete "zfj issue list --state=c" > zsh-value offered zsh --state=closed zsh-value
# PowerShell completes through TabExpansion2, as a prompt does. Legacy # argument passing is how Windows PowerShell 5.1 runs native commands, # so the empty word it leaves out is checked for there too. export POWERSHELL_TELEMETRY_OPTOUT=1 DOTNET_CLI_TELEMETRY_OPTOUT=1 pwsh-complete() { pwsh -NoProfile -NonInteractive -Command " \$PSNativeCommandArgumentPassing = '$1' zfj completion powershell | Out-String | Invoke-Expression (TabExpansion2 '$2' $(( ''${#2} ))).CompletionMatches | ForEach-Object CompletionText " } for passing in Standard Legacy; do pwsh-complete $passing "zfj iss" > pwsh-command offered "pwsh ($passing)" issue pwsh-command pwsh-complete $passing "zfj issue list --st" > pwsh-option offered "pwsh ($passing)" --state pwsh-option pwsh-complete $passing "zfj issue list --state " > pwsh-value offered "pwsh ($passing)" closed pwsh-value done
touch $out ''