@@ -119,6 +119,18 @@ _comp_cmd_gtar__parse_help_line()
119
119
done <<< " $1"
120
120
}
121
121
122
+ # Parse the output of "tar --help" with GNU tar and store the parse results
123
+ # into variables.
124
+ #
125
+ # @var[out] long_opts
126
+ # @var[out] short_opts
127
+ # @var[out] long_arg_none
128
+ # @var[out] long_arg_opt
129
+ # @var[out] long_arg_req
130
+ # @var[out] short_arg_none
131
+ # @var[out] short_arg_opt
132
+ # @var[out] short_arg_req
133
+ # The parse results are returned in these variables.
122
134
_comp_cmd_gtar__parse_help ()
123
135
{
124
136
local str line arg
@@ -193,6 +205,10 @@ _comp_cmd_tar__parse_old_opt()
193
205
}
194
206
195
207
# Make the analysis of whole command line.
208
+ #
209
+ # @var[out] old_opt_progress
210
+ # @var[out] old_opt_used
211
+ # @var[out,array] old_opt_parsed
196
212
_comp_cmd_tar__preparse_cmdline ()
197
213
{
198
214
local first_arg=set i modes=" ctxurdA"
@@ -507,11 +523,8 @@ _comp_cmd_tar__detect_ext()
507
523
508
524
_comp_cmd_tar__gnu ()
509
525
{
510
- local long_opts short_opts basic_tar=" " \
511
- long_arg_none=" " long_arg_opt=" " long_arg_req=" " \
512
- short_arg_none=" " short_arg_opt=" " short_arg_req=" " \
513
- tar_mode tar_mode_arg old_opt_progress=" " \
514
- old_opt_used=" " old_opt_parsed=()
526
+ local basic_tar=" " \
527
+ tar_mode tar_mode_arg
515
528
516
529
# Main mode, e.g. "x" or "c" or the long forms "extract" or "create"
517
530
local tar_mode=none
@@ -528,12 +541,15 @@ _comp_cmd_tar__gnu()
528
541
fi
529
542
530
543
local cur prev words cword was_split comp_args
531
-
532
544
_comp_initialize -s -- " $@ " || return
533
545
534
546
# Fill the {long,short}_{opts,arg*}
547
+ local long_opts short_opts \
548
+ long_arg_none=" " long_arg_opt=" " long_arg_req=" " \
549
+ short_arg_none=" " short_arg_opt=" " short_arg_req=" "
535
550
_comp_cmd_gtar__parse_help
536
551
552
+ local old_opt_progress=" " old_opt_used=" " old_opt_parsed=()
537
553
_comp_cmd_tar__preparse_cmdline " ${words[@]} "
538
554
539
555
local ext
@@ -694,11 +710,8 @@ _comp_cmd_tar__posix_prev_handle()
694
710
695
711
_comp_cmd_tar__posix ()
696
712
{
697
- local long_opts short_opts basic_tar=set \
698
- long_arg_none=" " long_arg_opt long_arg_req=" " \
699
- short_arg_none short_arg_opt short_arg_req \
700
- tar_mode tar_mode_arg old_opt_progress=" " \
701
- old_opt_used=set old_opt_parsed=()
713
+ local basic_tar=set \
714
+ tar_mode tar_mode_arg
702
715
703
716
# Main mode, e.g. -x or -c (extract/creation)
704
717
local tar_mode=none
@@ -710,15 +723,20 @@ _comp_cmd_tar__posix()
710
723
local tar_compression_mode=none
711
724
712
725
local cur prev words cword was_split comp_args
713
-
714
726
_comp_initialize -s -- " $@ " || return
715
727
728
+ # Initialize option variables:
716
729
# relatively compatible modes are {c,t,x}
717
730
# relatively compatible options {b,f,m,v,w}
731
+ # Note: long_opts, long_arg_*, short_arg_opt are currently unused
732
+ local long_opts short_opts \
733
+ long_arg_none=" " long_arg_opt long_arg_req=" " \
734
+ short_arg_none short_arg_opt short_arg_req
718
735
short_arg_req=" fb"
719
736
short_arg_none=" wmv"
720
737
short_opts=" $short_arg_req$short_arg_none "
721
738
739
+ local old_opt_progress=" " old_opt_used=set old_opt_parsed=()
722
740
_comp_cmd_tar__preparse_cmdline " ${words[@]} "
723
741
724
742
local ext
0 commit comments