This is mildly useful when activating virtualenvs. We had remove
these files earlier, but since there are no more false negatives from
__fish_complete_suffix it seems safe to re-add them.
0507b04 loosened the FreeBSD-only restriction on `pkg` completions to
!SunOS in order to support DragonFlyBSD. This is overly broad and can
still cause the script to be loaded on systems that we can't
realistically expect to have `pkg` be the FreeBSD pkgng package manager
(especially since `pkg` is a much more generic term when compared to the
likes of `dnf`, `yum`, `deb`, and `apt`).
This patch changes `pkg` + BSD to be the minimum requirements for
considering a system to be using pkgng.
In e8b6705067 this was made to exit if
not on FreeBSD because Solaris has a tool called "pkg" that apparently
"isn't worth supporting".
Since at least DragonflyBSD also uses FreeBSD's pkg thing, let's turn
that check around.
Of note: The rpm/yum thing seems to be coupled, so I put it into one
function that tries the yum helper and uses the rpm path otherwise.
Zypper is already its own thing, so this should only be used for yum
and probably dnf (does that still have the helper?)
Zypper can be dropped, as that already used a separate function in the file.
Apk can just be inlined - it's literally one line for installed and another for all packages.
Trying to switch to a remote branch like "upstream/ver2" will error with "fatal: a branch is expected, got remote branch 'upstream/ver2'", so these completions should only print the branch name. There doesn't seem to be a function for printing just the branch names for remotes (branch names can have forward-slashes in them), so I have just left them out for now.
This can use files/directories in a variety of ways, and it's
basically impossible to enumerate all of them - basically *any file*
could be mounted, if only there is a filesystem for it.
We still give the blockdevices and predefined mountpoints, so they can
still be used.
At least on Arch Linux, pacmd and pulseaudio aren't necessarily available just because pactl is (pipewire is now a thing, and it installs libpulse but not pulseaudio)
Only generate the list of snapshots when
a) the argument must be a snapshot and nothing else, or
b) the argument as typed contains a literal @, or
c) a snapshot is a valid completion and there is only one dataset
matching the argument as entered.
Unfortunately, it seems the `zfs` command itself is extremely primitive
and doesn't support listing snapshots by dataset so when we need to
generate completions, we end up needing to enumerate all snapshots
(ever) across all datasets. I'd be very happy to be proven wrong, but I
think the only other way would be manually parse `zdb` output.
See #7472