[Bash-completion-devel] wget(1) completion

Igor Murzov e-mail at date.by
Sun Jul 22 11:14:28 UTC 2012


> ping ? (this one being rerolled for years)
>
> forgot to re-attach the file:
> wget(1) completion

This completion looks good to me and I'd like to merge
it in. Please fix formating (no tabs, 80-column wrapping)
and prepare the patch. I know that you have a mirror of
bash-completion, but it doesn't have any branch that can
be merged -- wget related commits are distributed in your
master branch. So please create separate branch on top of
the origin/master for your wget related commits.

Some remarks:

 * Emacs indentation setting in the bottom should be removed.

 * Following code:

   ----------------------------------------------
   # prevopt is the previous options string used as a prefix
   # to avoid COMPREPLY replacing them with the $lastopt completion
   local lastopt=${cur/*,} prevopt=
   [[ $cur = *, ]] && prevopt=${cur%,*},
   ----------------------------------------------

   doesn't work. It's probably enough to replace '$cur = *,'
   with '$cur = *,*' to fix it.

 * I'm not sure if it is useful to add '-' to $COMPREPLY:

   [[ $cur = -* || -z $cur ]] && COMPREPLY+=( - )

   We don't even complete short options, so no need to
   complete something that is one character wide.

 * 
   ----------------------------------------------
   --tries|--dns-timeout|--connect-timeout|--timeout|--limit-rate|\
   --wait|--waitretry|--cut-dirs|--max-redirect)
       COMPREPLY=( $( compgen -W "{0..9}" -- $cur ) )
   ----------------------------------------------

   9 seconds at most is not enough for timeouts.

 *
   ----------------------------------------------
   --quota)
       COMPREPLY=( $( compgen -W "{0..9}{k,m}" -- $cur ) )
   ----------------------------------------------

   same thing here.

 * No need to be clever trying to keep user from doing
   something that he wants to do:

   # avoid accidentally overwriting files: suggest directories only

 * This one is too smart:

   # +o nospace when no more valid option is possible (= append a space)

   let's drop this part.

 * Completion script shouldn't spew tons of error messages
   if something goes wrong, so don't forget to append
   '2>/dev/null' every time you run some external tool like
   iconv or sed.


-- Igor



More information about the Bash-completion-devel mailing list