Skip to content

pacman completions: native, operation-aware flags from installed help - #1313

Merged
fdncred merged 3 commits into
nushell:mainfrom
mrl00:feat/pacman-completions
Nov 19, 2026
Merged

fdncred merged 3 commits into
nushell:mainfrom
mrl00:feat/pacman-completions

Conversation

@mrl00

@mrl00 mrl00 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add custom-completions/pacman/pacman-completions.nu with a single pacman extern and a native Nushell completer using the token and place records supported by Nushell 0.117.0.

How a completion request is resolved:

no operation selected -> suggest short and long operation names
operation selected -> read pacman - --help
current token is --* -> suggest long options with help descriptions
current token is -Q -> suggest combined short options such as -Qi
non-option token -> return null for default completion

Recognize database, files, query, remove, sync, deptest and upgrade operations in both short and long form. Read option names and descriptions from the installed pacman instead of maintaining a separate flag table for each operation. Help and version are also offered at the top level.

The extern deliberately declares no flags. Arguments use external_arg so Nushell does not rewrite short options or impose declared-flag parsing on pacman arguments. Completion requires neither Fish nor Carapace.

Scope and limitations

This contribution completes operations and flags, not package names or operation-specific argument values. Help parsing expects the current pacman option-line format; wrapped description continuations are not joined. Combined short flags are formed by appending the suggested flag to the current token, without checking duplicates or incompatible flags.

Validation

  • Passed toolkit check pr --and-exit with the new file supplied explicitly.
  • Verified commandline complete --detailed for pacman -Q, pacman -Q -, and pacman -S -- on Nushell 0.117.0.
  • Confirmed the local Nushell configuration passes nu-check after import.

The toolkit currently performs parsing/lint checks; its logic-test runner is not implemented.

image

### Description

Add custom-completions/pacman/pacman-completions.nu with a single
pacman extern and a native Nushell completer using the token and place
records supported by Nushell 0.117.0.

How a completion request is resolved:

  no operation selected -> suggest short and long operation names
  operation selected    -> read pacman -<operation> --help
  current token is --*  -> suggest long options with help descriptions
  current token is -Q   -> suggest combined short options such as -Qi
  non-option token      -> return null for default completion

Recognize database, files, query, remove, sync, deptest and upgrade
operations in both short and long form. Read option names and descriptions
from the installed pacman instead of maintaining a separate flag table
for each operation. Help and version are also offered at the top level.

The extern deliberately declares no flags. Arguments use external_arg
so Nushell does not rewrite short options or impose declared-flag parsing
on pacman arguments. Completion requires neither Fish nor Carapace.

### Scope and limitations

This contribution completes operations and flags, not package names or
operation-specific argument values. Help parsing expects the current
pacman option-line format; wrapped description continuations are not
joined. Combined short flags are formed by appending the suggested flag
to the current token, without checking duplicates or incompatible flags.

### Validation

- Passed toolkit check pr --and-exit with the new file supplied explicitly.
- Verified commandline complete --detailed for pacman -Q, pacman -Q -,
  and pacman -S -- on Nushell 0.117.0.
- Confirmed the local Nushell configuration passes nu-check after import.

The toolkit currently performs parsing/lint checks; its logic-test runner
is not implemented.
### Description

Add readme.md alongside the pacman completion module. Link to the official
pacman website for documentation and source downloads, explain that pacman
ships with Arch Linux, and note availability through distribution packages.

Document the Nushell version tested, the PATH requirement, and the import
to add to config.nu. Include Tab-completion examples for short operations,
long operations, combined short flags and long options.

Explain how operation-specific help supplies native suggestions without
Fish or Carapace. Document the current limits around package names, option
values, wrapped help descriptions and duplicate or incompatible flags.

### Validation

Documentation-only change. The import path matches the module location
and the examples reflect the previously verified completion behavior.
@fdncred
fdncred merged commit da6d041 into nushell:main Nov 19, 2026
1 check passed
@fdncred

fdncred commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Thanks

@mrl00
mrl00 deleted the feat/pacman-completions branch November 20, 2026 02:16
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