From 925f4517739ed564edcac6dd5ed29c2835461da9 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Wed, 9 Sep 2015 19:40:58 +0200 Subject: [PATCH] Add descriptions to dd completions Fixes #752. --- share/completions/dd.fish | 57 ++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/share/completions/dd.fish b/share/completions/dd.fish index cad9ef80d..9402661a5 100644 --- a/share/completions/dd.fish +++ b/share/completions/dd.fish @@ -25,8 +25,6 @@ function __fish_complete_dd --description 'Complete dd operands' end case 'iflag=*' 'oflag=*' - set -l flags append direct directory dsync sync fullblock nonblock noatime nocache noctty nofollow - set -l IFS = echo $operand_string | read -l operand value @@ -40,13 +38,19 @@ function __fish_complete_dd --description 'Complete dd operands' set complete $complete, end - for flag in $flags - echo $operand"="$complete$flag - end + printf "%s\t%s\n" "$operand=$complete""append" "append mode (makes sense only for output; conv=notrunc suggested)" + printf "%s\t%s\n" "$operand=$complete""direct" "use direct I/O for data" + printf "%s\t%s\n" "$operand=$complete""directory" "fail unless a directory" + printf "%s\t%s\n" "$operand=$complete""dsync" "use synchronized I/O for data" + printf "%s\t%s\n" "$operand=$complete""sync" "use synchronized I/O for data and metadata" + printf "%s\t%s\n" "$operand=$complete""fullblock" "accumulate full blocks of input (iflag only)" + printf "%s\t%s\n" "$operand=$complete""nonblock" "use non-blocking I/O" + printf "%s\t%s\n" "$operand=$complete""noatime" "do not update access time" + printf "%s\t%s\n" "$operand=$complete""nocache" "discard cached data" + printf "%s\t%s\n" "$operand=$complete""noctty" "do not assign controlling terminal from file" + printf "%s\t%s\n" "$operand=$complete""nofollow" "do not follow symbolic links" case 'conv=*' - set -l convs ascii ebcdic ibm block unblock lcase ucase swab sync excl nocreat notrunc noerror fdatasync fsync - set -l IFS = echo $operand_string | read -l operand value @@ -59,17 +63,40 @@ function __fish_complete_dd --description 'Complete dd operands' set complete $complete, end - for conv in $convs - echo $operand"="$complete$conv - end + printf "%s\t%s\n" "$operand=$complete""ascii" "from EBCDIC to ASCII" + printf "%s\t%s\n" "$operand=$complete""ebcdic" "from ASCII to EBCDIC" + printf "%s\t%s\n" "$operand=$complete""ibm" "from ASCII to alternate EBCDIC" + printf "%s\t%s\n" "$operand=$complete""block" "pad newline-terminated records with spaces to cbs-size" + printf "%s\t%s\n" "$operand=$complete""unblock" "replace trailing spaces in cbs-size records with newline" + printf "%s\t%s\n" "$operand=$complete""lcase" "change upper case to lower case" + printf "%s\t%s\n" "$operand=$complete""ucase" "change lower case to upper case" + printf "%s\t%s\n" "$operand=$complete""swab" "swap every pair of input bytes" + printf "%s\t%s\n" "$operand=$complete""sync" "pad every input block with NULs to ibs-size; with block or ublock use spaces" + printf "%s\t%s\n" "$operand=$complete""excl" "fail if the output file already exists" + printf "%s\t%s\n" "$operand=$complete""nocreat" "do not create the output file" + printf "%s\t%s\n" "$operand=$complete""notrunc" "do not truncate the output file" + printf "%s\t%s\n" "$operand=$complete""noerror" "continue after read errors" + printf "%s\t%s\n" "$operand=$complete""fdatasync" "physically write output file data before finishing" + printf "%s\t%s\n" "$operand=$complete""fsync" "physically write output file data and metadata before finishing" case 'status=*' - echo status=noxfer + printf "%s\t%s\n" status=noxfer "suppress final transfer statistics" + printf "%s\t%s\n" status=none "suppress everything but errors" + printf "%s\t%s\n" status=progress "show periodic transfer statistics" case '*' - set -l operands bs cbs conv count ibs if iflag obs of oflag seek skip status - for operand in $operands - echo $operand= - end + printf "%s=\t%s\n" bs "read and write up to BYTES bytes at a time" + printf "%s=\t%s\n" cbs "convert BYTES bytes at a time" + printf "%s=\t%s\n" conv "convert the file as per the comma separated symbol list" + printf "%s=\t%s\n" count "copy only BLOCKS input blocks" + printf "%s=\t%s\n" ibs "read up to BYTES bytes at a time (default 512)" + printf "%s=\t%s\n" if "read from FILE instead of stdin" + printf "%s=\t%s\n" iflag "read as per the comma separated symbol list" + printf "%s=\t%s\n" obs "write BYTES bytes at a time (default 512)" + printf "%s=\t%s\n" of "write to FILE instead of stdout" + printf "%s=\t%s\n" oflag "write as per the comma separated symbol list" + printf "%s=\t%s\n" seek "skip BLOCKS obs-sized blocks at the start of output" + printf "%s=\t%s\n" skip "skip BLOCKS ibs-sized blocks at the start of input" + printf "%s=\t%s\n" status "set the level of information to print to stderr" end end