@@ -203,9 +203,11 @@ _comp_cmd_tar__preparse_cmdline()
203203
204204 for i in " $@ " ; do
205205 case " $i " in
206- --delete | --test-label)
206+ --delete | --test-label | --catenate | --concatenate | --extract | --get | --update | --list | --append | --create )
207207 tar_mode=${i: 2: 100}
208- tar_mode_arg=$i
208+ # FIXME: We don't set $tar_mode_arg since it's used for combined
209+ # single letter options, but that means we don't handle
210+ # compression formats.
209211 break
210212 ;;
211213 --* )
@@ -236,7 +238,7 @@ _comp_cmd_tar__file_option()
236238 local ext=" $1 "
237239
238240 case " $tar_mode " in
239- c)
241+ c | create )
240242 # no need to advise user to re-write existing tarball
241243 _comp_compgen_filedir -d
242244 ;;
@@ -391,7 +393,7 @@ _comp_cmd_tar__adjust_PREV_from_old_option()
391393_comp_cmd_tar__extract_like_mode ()
392394{
393395 local i
394- for i in x d t delete; do
396+ for i in x d t delete extract get list ; do
395397 [[ $tar_mode == " $i " ]] && return 0
396398 done
397399 return 1
@@ -455,7 +457,7 @@ _comp_cmd_tar__detect_ext()
455457
456458 case " $tar_mode_arg " in
457459 --* )
458- # Should never happen?
460+ # FIXME: get correct extensions for long options (gnu style)
459461 ;;
460462 ? (-)* [cr]* f)
461463 ext=' @(tar|gem|spkg|cbt|xpbs)'
@@ -490,7 +492,7 @@ _comp_cmd_tar__gnu()
490492 tar_mode tar_mode_arg old_opt_progress=" " \
491493 old_opt_used=" " old_opt_parsed=()
492494
493- # Main mode, e.g. -x or -c ( extract/creation)
495+ # Main mode, e.g. "x" or "c" or the long forms " extract" or "create"
494496 local tar_mode=none
495497
496498 # The mode argument, e.g. -cpf or -c
@@ -685,8 +687,6 @@ _comp_cmd_tar__posix()
685687
686688 _comp_initialize -s -- " $@ " || return
687689
688- tar_mode=none
689-
690690 # relatively compatible modes are {c,t,x}
691691 # relatively compatible options {b,f,m,v,w}
692692 short_arg_req=" fb"
0 commit comments