Add completions for 21 macOS system utilities - #12874
Conversation
|
CI note: |
AGENTS.md — fish-shellThis file provides guidance to AGENTS (automated contributors / LLMs) working The authoritative source for contribution rules is RoleThe AGENT is a contributor. It writes idiomatic Rust or fish script, runs the Repository map
User-visible changes need a Build, format, testcargo build # debug build
cargo xtask format --all # rustfmt + fish_indent + ruff format
cargo test # Rust unit tests
tests/test_driver.py target/debug # system tests (or one: ... tests/checks/abbr.fish)
cargo xtask check # everything: all tests + lintersRules that apply to every change:
Contributing completionsThe rest of this file covers A completion script is ready for review when:
A minimal idiomatic completion, for shape: complete -c mycmd -f
complete -c mycmd -s v -l verbose -d "Print more output"
complete -c mycmd -n __fish_use_subcommand -a start -d "Start the service"
complete -c mycmd -n "__fish_seen_subcommand_from start" -a "(mycmd --list 2>/dev/null)"Principles
Common mistakes (bad → good)
Three mistakes involve state and need full context. 0/1 boolean flags — use # Bad
set -l saw_g 0
if test $saw_g -eq 1
...
end
# Good
set -l saw_g false
if $saw_g
...
endGlobal variables in completion files — completion files are sourced into # Bad
set -g __fish_dscl_ds_found 1
# Good
set -l ds_found
...
if set -q ds_found[1]
...
endDuplicated command-line parsing — several helpers each re-walking the # Bad: __fish_dscl_datasource and __fish_dscl_command each walk the tokens.
# Good: one positional parser, thin accessors.
function __fish_dscl_at
set -l pos (__fish_dscl_positionals)
set -q pos[$argv[1]]; and echo $pos[$argv[1]]
end
function __fish_dscl_datasource
__fish_dscl_at 1
end
function __fish_dscl_command
set -l cmd (__fish_dscl_at 2)
and string trim -l -c - -- $cmd
endIf a flag's behavior cannot be verified from the man page or |
Generated with: cargo xtask gettext update
b521717 to
3e06d77
Compare
|
Rebased the branch in place to fold the review feedback into the original per-tool commits (no fixup commits, per CONTRIBUTING): What changed across the 18 completions: exit-status contracts instead of redundant empty-string guards, One known gap: a number of |
Description
Adds completions for 21 macOS system tools that currently ship no completion (part of #3525):
codesign,csrutil,dscl,dseditgroup,fdesetup,hdiutil,installer,networksetup,osascript,pkgutil,pmset,profiles,screencapture,scutil,security,sips,softwareupdate,spctl,sysadminctl,system_profiler,systemsetupOne commit per completion so individual files can be dropped or amended easily.
Notes
__fishprefix and stay in their completion file; descriptions are kept short.fish_indent-formatted and source cleanly.--help, and sub-help output (e.g.scutil --nc help,pmset -g cap) via a deterministic string-match audit, with the remainder reviewed by hand — no invented flags or values.Happy to split this into smaller PRs, drop individual tools, or add a CHANGELOG entry if preferred.