For commands which support operating on files (i.e. disk images), it is
desirable for bash-completion to complete matching file names. It is
also desirable to complete on block device symlinks (e.g. under
/dev/disk). To complete common use cases, often on canonical device
names, continue to try completion using canonical device names, then
fall back to matching any file incrementally as Bash does by default.[1]
[1]: https://github.com/karelzak/util-linux/issues/842#issuecomment-523450243
Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Some of the fsck and mkfs commands complete differently than the others,
and differently than the desired behavior.[1] Standardize on completing
with $(lsblk -pnro name):
* fsck: Don't complete completes on all block devices and device links
under /dev immediately (which is excessive and prone to search
problems).
* mkfs, mkfs.bfs: Don't complete "/path/to/file" literally. I assume
this was copy/pasted from example code, since it does not appear to be
a valid argument unless it is a valid path, which is rare.
* fsck.cramfs, mkfs, mkfs.bfs, mkfs.cramfs, mkswap: Don't complete on
all filenames initially. The desired behavior is to complete
filenames only if there are no canonical matches.[1]
Note: A subsequent commit will add the desired fallback behavior.
[1]: https://github.com/karelzak/util-linux/issues/842#issuecomment-523450243
Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
fdformat:
Add --from, --to, and --repair options.
Commit: e0402441a1
fdisk:
Add --output [1], --bytes [2], --wipe [3], --wipe-partition [4], and
remove --geom- from from --cylinders, --heads, --sector options [5].
Commit [1]: fff8ad5882
Commit [2]: 354f8cc8cf
Commit [3]: cb9a4b0033
Commit [4]: ba465623d8
Commit [5]: 4b4e391a28
fsck.cramfs:
Broken since first commit.
Commit: bf60993cf2
mkswap:
Provide random uuid when completing --uuid argument.
partx:
Add --sector-size option. Fix also list of known partition types to
match with libblkid blkid_idinfo names. The fix is also applied to
manual page.
Commit: f8a4a0d4f2
Reference: git grep -A 4 blkid_idinfo libblkid/src/partitions | grep name
sfdisk:
Add --reoder, --delete, --mode-dataa, -no-tell-kernel, --wipe, and
--wipe-partitions options. In same go fix some option argument
completions.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Earlier completion suggested only options for the command, this changes
options to be proposed when first character of an argument is dash.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
The bash completion for more(1) treats the space-separated pieces of
filenames as different files.
$ touch foo\ bar
$ more foo<TAB>
bar foo
Reported-by: Ángel González <ingenit@zoho.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Users who know the short options can just hit the short option instead
of tab, and it's not likely that it would be helpful to present a list
of single character options to users who don't know them, doing so
just unnecessarily trashes the list of suggestions.
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>