Sitelet https://github.com/aurutils/aurutils/pull/1264
Skip to content

completions: add fish shell support via --dump-options - #1264

Closed
Strykar wants to merge 1 commit into
aurutils:masterfrom
Strykar:fish-completion-gen
Closed

Strykar wants to merge 1 commit into
aurutils:masterfrom
Strykar:fish-completion-gen

Conversation

@Strykar

@Strykar Strykar commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

Fish shell completions for aurutils, generated at build time from --dump-options like the bash completions already are.

Easier to maintain - the subcommands are discovered from lib/ and each script's flags are queried directly.

Depends on #1263 for the Perl scripts to support --dump-options.

Also fixes command_opts.sh to run scripts through their shebangs instead of hardcoding bash, so Perl scripts work during generation.

Closes #1260

@AladW

AladW commented Apr 19, 2026

Copy link
Copy Markdown
Member

Should be rebased to master

@Strykar
Strykar force-pushed the fish-completion-gen branch from 77edfeb to 0aaa0ff Compare April 21, 2026 10:47
@AladW

AladW commented Apr 23, 2026

Copy link
Copy Markdown
Member

Needs another rebase

Comment thread completions/fish/aurutils.in Outdated
Comment thread completions/fish/aurutils.in Outdated
Comment thread completions/fish/aurutils.in Outdated

@AladW AladW left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If the completions are generated at build-time, can we use zsh instead and re-use the descriptions defined in completions/zsh/_aur?

@Strykar
Strykar force-pushed the fish-completion-gen branch from 0aaa0ff to a7515bf Compare April 23, 2026 17:00
@AladW

AladW commented Apr 24, 2026

Copy link
Copy Markdown
Member

Zsh script instead of Perl parser (?!)

Rewrite the generator in zsh. The script sources completions/zsh/_aur
and overrides _arguments to capture the option specs each _aur-*
function would pass to the completion system. It then emits fish
'complete' directives from those captured specs.

Sourcing the file lets zsh handle its own parsing, so brace
expansion, quoting, and parameter expansion all resolve naturally
without a hand-written parser.

The bash completion is unchanged. Only fish generation moves to the
zsh-sourcing approach.

Co-Authored-By: Claude Opus
@Strykar
Strykar force-pushed the fish-completion-gen branch from a7515bf to e536bf1 Compare April 25, 2026 19:39
@AladW

AladW commented Apr 25, 2026

Copy link
Copy Markdown
Member

Please leave out the part from the commit message

Sourcing the file lets zsh handle its own parsing, so brace
expansion, quoting, and parameter expansion all resolve naturally
without a hand-written parser.

from the commit message since no normal person would have ever come up with such an absurd idea in the first place

source zsh/_aur

# Subcommand descriptions live in cmds[X]="Y" assignments inside _aur().
# That hash is local, so read the function's text.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Gibberish


fish_escape() { print -r -n -- "${1//\'/\\\'}" }

# Emit a bucket of brace-expanded aliases as one 'complete' directive.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Gibberish

@AladW

AladW commented Apr 25, 2026

Copy link
Copy Markdown
Member

Even though it now looks somewhat plausible,

  • The code remains highly complicated and brittle.
  • I can't review this, since I don't know zsh completions.
  • I can't test this, since I don't use fish.

It also seems likely that minute changes to zsh completions, will break the fish completions.

In other words, I don't think this idea is feasible anymore. Fish completions should limit themselves to output from --dump-options and forget about descriptions. This can be changed if an actual person looks at this, who has a working knowledge on how fish and its completions work.

@Strykar

Strykar commented Apr 25, 2026

Copy link
Copy Markdown
Contributor Author

Fair enough, closing.

@Strykar Strykar closed this Apr 25, 2026
@Strykar
Strykar deleted the fish-completion-gen branch April 25, 2026 21:47
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