Removed /usr/local from CDPATH
[clearscm.git] / rc / clearcase
1 #!/bin/bash
2 ################################################################################
3 #
4 # File:        $RCSfile: clearcase,v $
5 # Revision:    $Revision: 1.33 $ 
6 # Description: This script set up some useful environment variables and aliases
7 #              for Clearcase execution. File should be sourced (e.g . 
8 #              clearcase)
9 # Author:      Andrew@DeFaria.com
10 # Created:     Wed Jun  5 21:08:03 PDT 1996
11 # Modified:    $Date: 2011/10/24 18:07:05 $
12 # Language:    bash
13 #
14 # (c) Copyright 2000-2016, ClearSCM, Inc., all rights reserved.
15 #
16 ################################################################################
17 if [ $ARCHITECTURE = 'cygwin' ]; then
18   # The following should work but fails because they are using /c to mount
19   # the C drive and that messes things up.
20   export CCHOME=$(cygpath -u "$(regtool get '/machine/SOFTWARE/Atria/ClearCase/CurrentVersion/ProductHome' 2>/dev/null)" 2>/dev/null)
21   export CCHOME=/opt/rational/clearcase
22 else 
23   export CCHOME="/opt/rational/clearcase"
24 fi
25
26 if [ ! -d "$CCHOME" ]; then
27   unset CCHOME
28 #  exit
29 fi
30
31 # Source in clearcase.conf
32 if [ -f ~/.rc/clearcase.conf ]; then
33   source ~/.rc/clearcase.conf
34 else
35   echo "WARNING: Could not find ~/.rc/clearcase.conf - functionality will be limted"
36 fi
37
38 export CLEARTOOL="$CCHOME/bin/cleartool"
39 export CLEARCASE_BLD_HOST_TYPE="unix"
40
41 if [ -f "$CCHOME/etc/utils/creds" ]; then
42   if [ $ARCHITECTURE = 'cygwin' ]; then
43     alias creds=$(cygpath "$CCHOME/etc/utils/creds")
44   else 
45     alias creds="$CCHOME/etc/utils/creds"
46   fi
47 fi
48
49 if [ -x "$CLEARTOOL" ]; then
50   export RGY="$CCHOME/var/atria/rgy"
51   export LOGS="$CCHOME/var/log"
52 fi
53
54 function scm {
55   scmstatus=0
56
57   if [ -x "$CLEARTOOL" ]; then
58     # Cleartool suddenly started appending ^M's (I think as of 7.1)
59     if [ $ARCHITECTURE = 'cygwin' ]; then
60       # Need to set pipefail to pick up the exit code from cleartool
61       # otherwise we get the exit code from tr which is usually 0
62       set -o pipefail
63       "$CLEARTOOL" "$@" | tr -d "\015"
64       scmstatus=$?
65       set +o pipefail
66     else
67       "$CLEARTOOL" "$@"
68       scmstatus=$?
69     fi
70   else
71     scmstatus=1
72   fi
73
74   return $scmstatus
75 } # scm
76
77 function ct {
78   # Setview is special - there is no setview on Windows. But we approximate it
79   # with the function setview
80   if [ "$1" = "setview" ]; then
81         shift
82         setview "$@"
83   else
84     scm "$@"
85   fi
86   
87   return $scmstatus
88 } # ct
89
90 function scmsystem {
91   if [ "$(scm pwv)" != '' ]; then
92     return 1
93   elif [ -f CVS/Root ]; then
94     return 2
95   else
96     return 0
97   fi
98 } # scmsystem
99
100 function ci {
101   if [ $# = 0 ]; then
102     echo "ci: Error: No files specified"
103   else
104     scm ci "$@"
105   fi
106 } # ci
107
108 function co {
109   if [ $# = 0 ]; then
110     echo "co: Error: No files specified"
111   else
112     scm co "$@"
113   fi
114 } # co
115
116 function unco {
117   if [ $# = 0 ]; then
118     echo "unco: Error: No files specified"
119   else
120     scm unco "$@"
121   fi
122 } # unco
123
124 function lslock {
125   scm lslock "$@"
126 } # lslock
127
128 function lllock {
129   scm lslock -long "$@"
130 } # lllock
131
132 # View related functions
133 function setview {
134   if [ $ARCHITECTURE = 'cygwin' ]; then
135         if [[ $1 = -* ]]; then
136           echo "The setview command with options is not supported on Windows"
137           return
138         fi
139          
140     # Save off where we are
141     back=$PWD
142
143     # Start the view
144     scm startview "$@"
145
146     if [ $? != 0 ]; then
147       return $?
148     fi
149
150     # Setup $VOBTAG_PREFIX
151     mount -f -o binary M:/$1 $LINUX_VOBTAG_PREFIX
152
153     # Start a bash shell
154     bash
155
156     # Remove $LINUX_VOBTAG_PREFIX mount (Ignore errors)
157     umount $LINUX_VOBTAG_PREFIX 2> /dev/null
158
159     # Chdir back to were we started
160     cd $back
161   else
162     scm setview "$@"
163   fi
164
165   set_title
166   set_prompt
167 } # setview
168
169 function startview {
170   scm startview "$@"
171
172   mycd /view/$1
173 } # startview
174
175 function endview {
176   scm endview "$@"
177 } # endview
178
179 function killview {
180   scm endview -server "$@"
181 } # killview
182
183 function mkview {
184   scm mkview "$@"
185 } # mkview
186
187 function makeview {
188   if [ $# != 1 ]; then
189     echo "Usage: $FUNCNAME <stream>"
190     return 1
191   fi
192
193   stream=$1
194
195   # Check to see if the view already exists
196   scm lsview -short ${USER}_$stream > /dev/null 2>&1 
197
198   if [ $? = 0 ]; then
199     echo "${USER}_$stream already exists!"
200   else
201     mkview -tag ${USER}_$stream -stream $stream@$pvob -stgloc -auto
202
203     if [ $? != 0 ]; then
204       echo "Couldn't find that stream. Perhaps it's one of these?"
205       let i=${#stream}-4
206       searchFor=${stream:1:$i}
207       scm lsstream -short -invob $pvob | grep $searchFor | $PAGER
208       return 0
209     fi
210   fi
211
212   setview ${USER}_$stream
213 } # makeview
214
215 function rmview {
216   scm rmview "$@"
217 } # rmview
218
219 function lsview {
220   if [ $# = 0 ]; then
221     scm lsview -s | $PAGER
222   elif [ $# = 1 ]; then
223     scm lsview -s | grep "$1"
224   else
225     scm lsview "$@"
226   fi
227 } # lsview
228
229 function myviews {
230   # Well they asked for my "views"...
231   if [ $(whence fortune) ]; then
232     fortune
233     echo
234   fi    
235
236   # List my views and their associated activities
237   for view in $(scm lsview -s 2>&1 | grep $USER); do
238     headline=$(scm lsact -cact -fmt "%[headline]p" -view $view 2> /dev/null)
239    
240     if [ "$headline" = "" ]; then
241       headline="<no activity set>"
242     fi
243
244     echo -e "$view\t$headline"
245   done
246 } # myviews
247
248 function llview {
249   if [ $# = 0 ]; then
250     scm lsview -long | $PAGER
251   else 
252     scm lsview -long "$@"
253   fi
254 } # llview
255
256 function lsviews {
257   if [ $# = 0 ]; then
258     scm lsview -short
259   else 
260     scm lsview -short | grep $1
261   fi
262 } # lsviews
263
264 # Vob related functions
265 function lsvob {
266   if [ $# = 0 ]; then
267     scm lsvob | $PAGER
268   elif [ $# = 1 ]; then
269     scm lsvob | grep "$1"
270   else
271     scm lsvob "$@"
272   fi
273 } # lsvob
274
275 function llvob {
276   if [ $# = 0 ]; then
277     scm lsvob -long | $PAGER
278   else 
279     scm lsvob -long "$@"
280   fi
281 } # llvob
282
283 function lsvobs {
284   if [ $# = 0 ]; then
285     scm lsvob -short
286   else 
287     scm lsvob -short | grep $1
288   fi
289 } # lsvobs
290
291 # Config spec functions
292 function setcs {
293   scm setcs "$@"
294 } # setcs
295
296 function edcs {
297   scm edcs "$@"
298 } # edcs
299
300 function catcs {
301   scm catcs "$@"
302 } # catcs
303
304 function pwv {
305   scm pwv -s "$@"
306 } # pwv
307
308 function rmtag {
309   scm rmtag "$@"
310 } # rmtag
311
312 function mktag {
313   scm mktag "$@"
314 } # mktag
315
316 function describe {
317   scm describe "$@"
318 } # describe
319
320 function desc {
321   scm describe "$@"
322 } # describe
323
324 function oid2name {
325   if [ $# == 2 ]; then
326     oid=$1
327     projvob=$2
328   elif [ $# == 1 ]; then
329     oid=$1
330     projvob=$pvob
331   else
332     echo "Usage: oid2name: <oid> [<pvob>]"
333     
334     return
335   fi
336   
337   scm describe oid:$oid@$projvob 2> /dev/null | head -1
338 } # oid2name
339
340 function name2oid {
341   if [ $# == 3 ]; then
342     type=$1
343     name=$2
344     projvob=$3
345   elif [ $# == 2 ]; then
346     type=$1
347     name=$2
348     projvob=$pvob
349   else
350     echo "Usage: name2oid: <type> <name> [<pvob>]"
351     
352     return
353   fi
354
355   scm dump $type:$name@$projvob 2> /dev/null | grep oid=
356 } # name2oid
357
358 # Action functions
359 function vtree {
360   if [ $# != 1 ]; then
361     echo "vtree: Error: Must specify an element to view its version tree"
362   else
363     if [ $ARCHITECTURE = 'cygwin' ]; then
364       scm lsvtree -g "$@"
365     else
366       xlsvtree "$@"
367     fi
368   fi
369 } # vtree
370
371 function merge {
372   scm merge "$@"
373 } # merge
374
375 function findmerge {
376   scm findmerge "$@"
377 } # findmerge
378
379 function cdiff {
380   scmsystem; scmtype=$?
381
382   if [ $# = 1 ]; then
383     if [ $scmtype = 1 ]; then
384       scm diff -graphical -pred $1
385     elif [ $scmtype = 2 ]; then
386       cvs diff $1
387     fi
388   else
389     if [ $scmtype = 1 ]; then
390       scm diff -graphical "$@"
391     elif [ $scmtype = 2 ]; then
392       cvs diff "$@"
393     fi
394   fi
395 } # cdiff
396
397 function ctdiff {
398   if [ $# = 1 ]; then
399     scm xdiff -vstack -pred $1
400   else
401     scm xdiff -vstack $@
402   fi
403 } # ctdiff
404
405 # Administrative functions
406 function space {
407   scm space "$@"
408 } # space
409
410 function register {
411   scm register "$@"
412 } # register
413
414 function unregister {
415   scm unregister "$@"
416 } # unregister
417
418 # Information functions
419 function hostinfo {
420   scm hostinfo "$@"
421 } # hostinfo
422
423 function lstrig {
424   if [ $# = 2 ]; then
425     trig_name=$1
426     vob=$2
427     scm lstype trtype:$trig_name@$vob
428   else
429     scm lstype -kind trtype "$@" | $PAGER
430   fi
431 } # lstrig
432
433 function lltrig {
434   if [ $# = 1 ]; then
435     scm lstype -long trtype:$1
436   else
437     scm lstype -long -kind trtype "$@"| $PAGER
438   fi
439 } # lltrig
440
441 function lsbr {
442   scm lstype -brtype
443 } # lsbr
444
445 function lslab {
446   scm lstype -lbtype
447 } # lslab
448
449 # UCM oriented functions
450 function lsstream {
451   if [ $# = 0 ]; then
452     # If we are in a view context then try to list the stream for our view
453     if [[ $(pwv) == "** NONE **" ]]; then
454       lsstreams | $PAGER
455     else
456       scm lsstream | $PAGER
457     fi
458   else
459     # Check to see if a pvob was specified
460     if [[ $@ == *@* ]]; then
461       scm lsstream "$@"
462     else
463       scm lsstream -invob $pvob | grep $1 | $PAGER
464     fi
465   fi
466 } # lsstream
467
468 function llstream {
469   if [ $# = 0 ]; then
470     scm lsstream -l | $PAGER
471   else
472     scm lsstream -l "$@"
473   fi
474 } # llstream
475
476 function lsstreams {
477   if [ $# = 0 ]; then
478     scm lsstream -short -invob $pvob
479   else 
480     scm lsstream -short "$@"
481   fi
482 } # lstreams
483
484 function lsregions () {
485   if [ $# -gt 0 ]; then
486         scm lsregion -short | grep ^$1 
487   else
488     scm lsregion -short
489   fi
490 } # lsregions
491
492 function rebase {
493   scm rebase "$@"
494 } # rebase
495
496 function deliver {
497   scm deliver "$@"
498 } # deliver
499
500 function lsbl {
501   scm lsbl "$@"
502 } # lsbl
503
504 function lsll {
505   scm lsbl -lon "$@"
506 } # llbl
507
508 function lsproj {
509   if [ $# = 0 ]; then
510     scm lsproject | $PAGER
511   else
512     scm lsproject "$@"
513   fi
514 } # lsproj
515
516 function llproj {
517   if [ $# = 0 ]; then
518     scm lsproject -l | $PAGER
519   else
520     scm lsproject -l "$@"
521   fi
522 } # llproj
523
524 function lsfolder {
525   scm lsfolder "$@"
526 } # lsfolder
527
528 function llfolder {
529   scm lsfolder -long "$@"
530 } # llfolder
531
532 function lsstgloc {
533   if [ $# = 0 ]; then
534     scm lsstgloc | $PAGER
535   else
536     scm lsstgloc "$@"
537   fi
538 } # lsstgloc
539
540 function llstgloc {
541   if [ $# = 0 ]; then
542     scm lsstgloc -l | $PAGER
543   else
544     scm lsstgloc -l "$@"
545   fi
546 } # llstgloc
547
548 function lsact {
549   if [ $# = 0 ]; then
550     scm lsactivity | $PAGER
551   else
552     scm lsactivity "$@"
553   fi
554 } # lsact
555
556 function llact {
557   if [ $# = 0 ]; then
558     scm lsactivity -l | $PAGER
559   else
560     scm lsactivity -l "$@"
561   fi
562 } # llact
563
564 function setact {
565   if [ $# = 0 ]; then
566     echo "What? Am I suppose to guess?!?"
567     exit 1
568   else
569     scm setactivity "$@"
570   fi
571 } # setact
572
573 function clist {
574   scmsystem; scmtype=$?
575
576   if [ $scmtype = 1 ]; then
577     scm lsco -short -cview -all -me
578   elif [ $scmtype = 2 ]; then
579     cvs -Q status | grep ^File | grep -v Up-to-date
580   fi
581 } # clist
582
583 function ciwork {
584   scm ci -cq $(clist)
585 } # ciwork
586
587 # Bash completion for Clearcase commands. T
588
589 # Add "," to COMP_BREAKWORDS
590 COMP_WORDBREAKS=\ \"\'\>\<\=\;\|\&\(\:\,
591
592 # All Clearcase commands
593 _scm_cmds="\
594 annotate \
595 catcr \
596 catcs \
597 cd \
598 chactivity \
599 chbl \
600 checkin \
601 checkout \
602 checkvob \
603 chevent \
604 chflevel \
605 chfolder \
606 chmaster \
607 chpool \
608 chproject \
609 chstream \
610 chtype \
611 chview \
612 ci \
613 co \
614 cptype \
615 deliver \
616 describe \
617 diff \
618 diffbl \
619 diffcr \
620 dospace \
621 edcs \
622 endview \
623 file \
624 find \
625 findmerge \
626 get \
627 getcache \
628 getlog \
629 help \
630 hostinfo \
631 ln \
632 lock \
633 ls \
634 lsactivity \
635 lsbl \
636 lscheckout \
637 lscheckout \
638 lsclients \
639 lscomp \
640 lsdo \
641 lsfolder \
642 lshistory \
643 lslock \
644 lsmaster \
645 lspool \
646 lsprivate \
647 lsproject \
648 lsregion \
649 lsreplica \
650 lssite \
651 lsstgloc \
652 lsstream \
653 lstype \
654 lstype \
655 lsview \
656 lsvob \
657 lsvtree \
658 man \
659 merge \
660 mkactivity \
661 mkattr \
662 mkattype \
663 mkbl \
664 mkbranch \
665 mkbrtype \
666 mkcomp \
667 mkdir \
668 mkelem \
669 mkeltype \
670 mkfolder \
671 mkhlink \
672 mkhltype \
673 mklabel \
674 mklbtype \
675 mkpool \
676 mkproject \
677 mkregion \
678 mkstgloc \
679 mkstream \
680 mktag \
681 mktrigger \
682 mktrtype \
683 mkview \
684 mkvob \
685 mount \
686 move \
687 protect \
688 protectvob \
689 pwd \
690 pwv \
691 quit \
692 rebase \
693 recoverview \
694 reformatview \
695 reformatvob \
696 register \
697 relocate \
698 rename \
699 reqmaster \
700 reserve \
701 rmactivity \
702 rmattr \
703 rmbl \
704 rmbranch \
705 rmcomp \
706 rmdo \
707 rmelem \
708 rmfolder \
709 rmhlink \
710 rmlabel \
711 rmmerge \
712 rmname \
713 rmpool \
714 rmproject \
715 rmregion \
716 rmstgloc \
717 rmstream \
718 rmtag \
719 rmtrigger \
720 rmtype \
721 rmver \
722 rmview \
723 rmvob \
724 schedule \
725 setactivity \
726 setcache \
727 setcs \
728 setplevel \
729 setsite \
730 setview \
731 space \
732 startview \
733 umount \
734 uncheckout \
735 unlock \
736 unregister \
737 unreserve \
738 update \
739 winkin \
740 "
741 # Kinds
742 _kinds="\
743 attype \
744 brtype \
745 eltype \
746 hltype \
747 lbtype \
748 trtype \
749 "
750 # Type selectors
751 _type_selectors="\
752 attype: \
753 brtype: \
754 eltype: \
755 hltype: \
756 lbtype: \
757 trtype: \
758 "
759 # These options are common to all scm commands. So far -help is the only one
760 _global_opts="\
761 -help \
762 "
763 # Comment opts. These options are common for commands that request the user
764 # specify a comment
765 _comment_opts="\
766 -c \
767 -cfile \
768 -cq \
769 -cqe \
770 -nc \
771 "
772 # Individual command options
773 _annotate_opts="\
774 $_global_opts \
775 -all \
776 -fmt \
777 -force \
778 -long \
779 -nco \
780 -ndata \
781 -nheader \
782 -out \
783 -rm \
784 -rmfmt \
785 -short \
786 "
787 _catcr_opts="\
788 $_global_opts \
789 -check \
790 -ci \
791 -critical \
792 -element \
793 -flat \
794 -follow \
795 -long \
796 -makefile \
797 -name \
798 -nxname \
799 -recurse \
800 -scripts \
801 -select \
802 -short \
803 -type \
804 -union \
805 -view \
806 -wd \
807 -zero \
808 "
809 _chbl_opts="\
810 $_global_opts \
811 $_comment_opts \
812 -full \
813 -incremental \
814 -level \
815 -nrecurse \
816 "
817 _checkout_opts="\
818 $_global_opts \
819 $_comment_opts \
820 -branch \
821 -ndata \
822 -nmaster \
823 -nquery \
824 -nwarn \
825 -out \
826 -ptime \
827 -query \
828 -reserved \
829 -unreserved \
830 -usehijack \
831 -version \
832 "
833 _chflevel_opts="\
834 $_global_opts \
835 -auto \
836 -family \
837 -force \
838 -master \
839 -override \
840 -replica \
841 "
842 _chpool_opts="\
843 $_global_opts \
844 $_comment_opts \
845 -force \
846 "
847 _chtype_opts="\
848 $_global_opts \
849 $_comment_opts \
850 -force \
851 -pname \
852 "
853 _diff_opts="\
854 $_global_opts \
855 -graphical \
856 -hstack \
857 -options \
858 -predecessor \
859 -serial \
860 -tiny \
861 "
862 _diffbl_opts="\
863 $_global_opts \
864 -activities \
865 -baselines \
866 -first \
867 -graphical \
868 -nmerge \
869 -nrecurse \
870 -predecessor \
871 -versions \
872 "
873 _diffcr_opts="\
874 $_global_opts \
875 -ci \
876 -critical \
877 -element \
878 -follow \
879 -long \
880 -name \
881 -nxname \
882 -recurse \
883 -select \
884 -short \
885 -type \
886 -view \
887 -wd \
888 "
889 _edcs_opts="\
890 $_global_opts \
891 -ctime \
892 -overwrite \
893 -ptime \
894 -rename \
895 -tag \
896 "
897 _deliver_opts="\
898 $_global_opts \
899 -abort \
900 -activities \
901 -baseline \
902 -cact \
903 -cancel \
904 -complete \
905 -force \
906 -gmerge \
907 -graphical \
908 -long \
909 -ok \
910 -preview \
911 -qall \
912 -qntrivial \
913 -query \
914 -reset \
915 -resume \
916 -serial \
917 -short \
918 -status \
919 -stream \
920 -target \
921 -to \
922 "
923 _diff_opts="\
924 $_global_opts \
925 -columns \
926 -diff \
927 -graphical \
928 -hstack \
929 -options \
930 -predecessor \
931 -serial \
932 -tiny \
933 -vstack \
934 "
935 _diffbl_opts="\
936 $_global_opts \
937 -activities \
938 -baselines \
939 -elements \
940 -first \
941 -graphical \
942 -nmerge \
943 -nrecurse \
944 -predecessor \
945 -versions \
946 "
947 _diffcr="\
948 $_global_opts \
949 -ci \
950 -critical \
951 -element \
952 -flat \
953 -follow \
954 -long \
955 -name \
956 -nxname \
957 -recurse \
958 -select \
959 -short \
960 -type \
961 -view \
962 -wd \
963 "
964 _dospace_opts="\
965 $_global_opts \
966 -all \
967 -before \
968 -dump \
969 -generate \
970 -pool \
971 -references \
972 -region \
973 -scrub \
974 -since \
975 -size \
976 -top \
977 -update \
978 "
979 _find_opts="\
980 $_global_opts \
981 -all \
982 -avobs \
983 -branch \
984 -cview \
985 -depth \
986 -directory \
987 -element \
988 -exec \
989 -follow \
990 -group \
991 -kind \
992 -name \
993 -nrecurse \
994 -nvisible \
995 -nxname \
996 -ok \
997 -type \
998 -user \
999 -version \
1000 -visible \
1001 "
1002 _mkelem_opts="\
1003 $_global_opts \
1004 -c \
1005 -cfile \
1006 -ci \
1007 -cq \
1008 -cqe \
1009 -eltype \
1010 -master \
1011 -mkpath \
1012 -nc \
1013 -nco \
1014 -nwarn \
1015 "
1016 _findmerge_opts="\
1017 $_global_opts \
1018 $_comment_opts \
1019 -abort \
1020 -all \
1021 -avobs \
1022 -blank \
1023 -depth \
1024 -directory \
1025 -element \
1026 -exec \
1027 -fbtag \
1028 -fcsets \
1029 -flatest \
1030 -follow \
1031 -ftag \
1032 -graphical \
1033 -group \
1034 -log \
1035 -long \
1036 -name \
1037 -nback \
1038 -nrecurse \
1039 -nxname \
1040 -nzero \
1041 -ok \
1042 -okgmerge \
1043 -okmerge \
1044 -qall \
1045 -qntrivial \
1046 -query \
1047 -serial \
1048 -short \
1049 -type \
1050 -unreserved \
1051 -user \
1052 -visible \
1053 -whynot \
1054 "
1055 _get_opts="\
1056 $_global_opts \
1057 -to \
1058 "
1059 _getcache_opts="\
1060 $_global_opts \
1061 -all \
1062 -host \
1063 -mvfs \
1064 -persistent \
1065 -reset \
1066 -short \
1067 -site \
1068 -view \
1069 "
1070 _ln_opts="\
1071 $_global_opts \
1072 $_comment_opts \
1073 -force \
1074 -nco \
1075 -slink \
1076 "
1077 _ls_opts="\
1078 $_global_opts \
1079 -directory \
1080 -long \
1081 -nxname \
1082 -recurse \
1083 -short \
1084 -view_only \
1085 -visibile \
1086 -vob_only \
1087 "
1088 _lscheckout_opts="\
1089 $_global_opts \
1090 -all \
1091 -areplicas \
1092 -avobs \
1093 -brtype \
1094 -cview \
1095 -directory \
1096 -fmt \
1097 -graphical \
1098 -long \
1099 -me \
1100 -recurse \
1101 -short \
1102 -user \
1103 "
1104 _lsdo_opts="\
1105 $_global_opts \
1106 -fmt \
1107 -long \
1108 -me \
1109 -nshareable_dos \
1110 -recurse \
1111 -short \
1112 -sname \
1113 -stime \
1114 -zero \
1115 "
1116 _lshistory_opts="\
1117 $_global_opts \
1118 -all \
1119 -avobs \
1120 -branch \
1121 -directory \
1122 -eventid \
1123 -fmt \
1124 -graphical \
1125 -last \
1126 -local \
1127 -long \
1128 -me \
1129 -minor \
1130 -nco \
1131 -nopreferences \
1132 -pname \
1133 -recurse \
1134 -short \
1135 -since \
1136 -user \
1137 "
1138 _lslock_opts="\
1139 $_global_opts \
1140 -all \
1141 -fmt \
1142 -local \
1143 -long \
1144 -obsolete \
1145 -pname \
1146 -short \
1147 "
1148 _lsmaster_opts="\
1149 $_global_opts \
1150 -all \
1151 -fmt \
1152 -inreplicas \
1153 -kind \
1154 -view \
1155 "
1156 _lsreplica_opts="\
1157 $_global_opts \
1158 -all \
1159 -fmt \
1160 -inreplicas \
1161 -invob \
1162 -long \
1163 -short \
1164 -siblings \
1165 "
1166 _lssite_opts="\
1167 $_global_opts \
1168 -inquire \
1169 -setting-name \
1170 "
1171 _lsstream_opts="\
1172 $_global_opts \
1173 -ancestor \
1174 -cview \
1175 -depth \
1176 -fmt \
1177 -in \
1178 -invob \
1179 -long \
1180 -obsolete \
1181 -recurse \
1182 -short \
1183 -template \
1184 -tree \
1185 -view \
1186 "
1187 _lsvtree_opts="\
1188 $_global_opts \
1189 -all \
1190 -branch \
1191 -graphical \
1192 -merge \
1193 -nco \
1194 -nmerge \
1195 -nrecurse \
1196 -obsolete \
1197 -short \
1198 "
1199 _merge_opts="\
1200 $_global_opts \
1201 -abort \
1202 -base \
1203 -c \
1204 -cfile \
1205 -columns \
1206 -cq \
1207 -cqe \
1208 -delete \
1209 -diff \
1210 -graphical \
1211 -insert \
1212 -narrows \
1213 -nc \
1214 -ndata \
1215 -options \
1216 -out \
1217 -qall \
1218 -qntrivial \
1219 -query \
1220 -replace \
1221 -serial \
1222 -tiny \
1223 -to \
1224 -version \
1225 "
1226 _mkattr_opts="\
1227 $_global_opts \
1228 $_comment_opts \
1229 -ci \
1230 -config \
1231 -default \
1232 -name \
1233 -pname \
1234 -replace \
1235 -select \
1236 -type \
1237 -version \
1238 "
1239 _mkattype_opts="\
1240 $_global_opts \
1241 $_comment_opts \
1242 -acquire \
1243 -default
1244 -enum \
1245 -ge \
1246 -global \
1247 -gt \
1248 -le
1249 -lt
1250 -ordinary \
1251 -replace \
1252 -shared \
1253 -vpbranch \
1254 -vpelement \
1255 -vpversion \
1256 -vtype \
1257 "
1258 _mkbranch_opts="\
1259 $_global_opts \
1260 $_comment_opts \
1261 -nco \
1262 -nwarn \
1263 -ptime \
1264 -version \
1265 "
1266 _mkbrtype_opts="\
1267 $_global_opts \
1268 -acquire \
1269 -global \
1270 -ordinary \
1271 -pbranch \
1272 -replace \
1273 "
1274 _mkdir_opts="\
1275 $_global_opts \
1276 $_comment_opts \
1277 -master \
1278 -nco \
1279 "
1280 _mkelem_opts="\
1281 $_global_opts \
1282 $_comment_opts \
1283 -ci \
1284 -eltype \
1285 -master \
1286 -mkpath \
1287 -nco \
1288 -nwarn \
1289 -ptime \
1290 "
1291 _mkeltype_opts="\
1292 $_global_opts \
1293 $_comment_opts \
1294 -acquire \
1295 -global \
1296 -manager \
1297 -mergetype \
1298 -ordinary \
1299 -ptime \
1300 -replace \
1301 -supertype \
1302 "
1303 _mkhlink_opts="\
1304 $_global_opts \
1305 $_comment_opts \
1306 -acquire \
1307 -fpname \
1308 -ftext \
1309 -tpname \
1310 -ttext \
1311 -unidir \
1312 "
1313 _mkhltype_opts="\
1314 $_global_opts \
1315 $_comment_opts \
1316 -acquire \
1317 -global \
1318 -ordinary \
1319 -replace \
1320 -shared \
1321 "
1322 _mklabel_opts="\
1323 $_global_opts \
1324 $_comment_opts \
1325 -ci \
1326 -config \
1327 -follow \
1328 -name \
1329 -nc \
1330 -recurse \
1331 -replace \
1332 -select \
1333 -type \
1334 -version \
1335 "
1336 _mklbtype_opts="\
1337 $_global_opts \
1338 $_comment_opts \
1339 -acquire \
1340 -global \
1341 -ordinary \
1342 -pbranch \
1343 -replace \
1344 -shared \
1345 "
1346 _mkpool_opts="\
1347 $_global_opts \
1348 $_comment_opts \
1349 -age \
1350 -alert \
1351 -cleartext \
1352 -ln \
1353 -size \
1354 -source \
1355 -update \
1356 "
1357 _mktrigger_opts="\
1358 $_global_opts \
1359 $_comment_opts \
1360 -force \
1361 -nattach \
1362 -ninherit \
1363 -recurse \
1364 "
1365 _move_opts="\
1366 $_global_opts \
1367 $_comment_opts \
1368 "
1369 _protect_opts="\
1370 $_global_opts \
1371 $_comment_opts \
1372 -chgrp \
1373 -chmod \
1374 -chown \
1375 -directory \
1376 -file \
1377 -pname \
1378 -recurse \
1379 "
1380 _protectvob_opts="\
1381 $_global_opts \
1382 -add_group \
1383 -chgrp \
1384 -chown \
1385 -delete_group \
1386 -force \
1387 -nremote_admin \
1388 -remote_admin \
1389 "
1390 _pwv_opts="\
1391 -root \
1392 -setview \
1393 -short \
1394 -wdview \
1395 "
1396 _relocate_opts="\
1397 $_global_opts \
1398 -force \
1399 -log \
1400 -qall \
1401 -update \
1402 "
1403 _rename_opts="\
1404 $_global_opts \
1405 $_comment_opts \
1406 -acquire \
1407 "
1408 _reqmaster_opts="\
1409 $_global_opts \
1410 $_comment_opts \
1411 -acl \
1412 -allow \
1413 -deny \
1414 -disable \
1415 -edit \
1416 -enable \
1417 -get \
1418 -instances \
1419 -list \
1420 -set \
1421 "
1422 _reserve_opts="\
1423 $_global_opts \
1424 $_comment_opts \
1425 -cact \
1426 "
1427 _rmbranch_opts="\
1428 $_global_opts \
1429 $_comment_opts \
1430 -force \
1431 "
1432 _rmdo_opts="\
1433 $_global_opts \
1434 -all \
1435 -before \
1436 -since \
1437 -zero \
1438 "
1439 _rmelem_opts="\
1440 $_global_opts \
1441 $_comment_opts \
1442 -force \
1443 "
1444 _rmmerge_opts="\
1445 $_global_opts \
1446 $_comment_opts \
1447 "
1448 _rmname_opts="\
1449 $_global_opts \
1450 $_comment_opts \
1451 -force \
1452 "
1453 _rmpool_opts="\
1454 $_global_opts \
1455 $_comment_opts \
1456 "
1457 _rmstream_opts="\
1458 $_global_opts \
1459 $_comment_opts \
1460 "
1461 _rmver_opts="\
1462 $_global_opts \
1463 $_comment_opts \
1464 -data \
1465 -force \
1466 -version \
1467 -vrange \
1468 -xattr \
1469 -xbranch \
1470 -xhlink \
1471 -xlabel \
1472 "
1473 _schedule_opts="\
1474 $_global_opts \
1475 -acl \
1476 -delete \
1477 -edit \
1478 -force \
1479 -get \
1480 -host \
1481 -job \
1482 -run \
1483 -schedule \
1484 -set \
1485 -status \
1486 -tasks \
1487 -wait \
1488 "
1489 _setactivity_opts="\
1490 $_global_opts \
1491 $_comment_opts \
1492 -none \
1493 -view \
1494 "
1495 _setcache_opts="\
1496 $_global_opts \
1497 -acache \
1498 -cachesize \
1499 -cto \
1500 -cview \
1501 -cvpfreemax \
1502 -cvpfreemin \
1503 -default \
1504 -dirdnc \
1505 -dncache \
1506 -host \
1507 -mnmax \
1508 -mvfs \
1509 -nacache \
1510 -ncto \
1511 -ndncachez \
1512 -noentdnc \
1513 -nrlcache \
1514 -nrvcache \
1515 -password \
1516 -persistent \
1517 -persistent_only \
1518 -readdir_blocks \
1519 -regdnc \
1520 -rlcache \
1521 -rpchandles \
1522 -rvcache \
1523 -scalefactor \
1524 -site \
1525 -view \
1526 -vobfreemax \
1527 -vobfreemin \
1528 -zone \
1529 "
1530 _setsite_opts="\
1531 $_global_opts \
1532 -password \
1533 "
1534 _uncheckout_opts="\
1535 $_global_opts \
1536 -cact \
1537 -keep \
1538 -rm \
1539 -unco \
1540 "
1541 _unregister_opts="\
1542 $_global_opts \
1543 -uuid \
1544 -view \
1545 -vob \
1546 "
1547 _unreserve_opts="\
1548 $_global_opts \
1549 $_comment_opts \
1550 -cact \
1551 -view \
1552 "
1553 _update_opts="\
1554 $_global_opts \
1555 -add_loadrules \
1556 -ctime \
1557 -force \
1558 -graphical \
1559 -log \
1560 -noverwrite \
1561 -overwrite \
1562 -print \
1563 -ptime \
1564 -rename \
1565 "
1566 _winkin_opts="\
1567 $_global_opts \
1568 -adirs \
1569 -adirs \
1570 -ci \
1571 -noverwrite \
1572 -out \
1573 -print \
1574 -recurse \
1575 -select \
1576 -siblings \
1577 "
1578
1579 _object_selectors="\
1580 activity: \
1581 attype: \
1582 baseline: \
1583 brtype: \
1584 component: \
1585 eltype: \
1586 folder: \
1587 hlink: \
1588 hltype: \
1589 lbtype: \
1590 oid: \
1591 pool: \
1592 project: \
1593 replica: \
1594 stream: \
1595 trtype: \
1596 vob: \
1597 "
1598
1599 _operation_types="\
1600 chactivity \
1601 chbl \
1602 checkin \
1603 checkout \
1604 chevent \
1605 chfolder \
1606 chmaster \
1607 chproject \
1608 chstream \
1609 chtype \
1610 deliver_cancel \
1611 deliver_complete \
1612 deliver_start \
1613 lnname \
1614 lock \
1615 mkactivity \
1616 mkattr \
1617 mkbl \
1618 mkbl_complete \
1619 mkbranch \
1620 mkcomp \
1621 mkelem \
1622 mkfolder \
1623 mkhlink \
1624 mklabel \
1625 mkproject \
1626 mkslink \
1627 mkstream \
1628 mktrigger \
1629 protect \
1630 rebase_cancel \
1631 rebase_complete \
1632 rebase_start \
1633 reserve \
1634 rmactivity \
1635 rmattr \
1636 rmbranch \
1637 rmcl \
1638 rmcomp \
1639 rmelem \
1640 rmfolder \
1641 rmhlink \
1642 rmlabel \
1643 rmname \
1644 rmproject \
1645 rmstream \
1646 rmtrigger \
1647 rmver \
1648 setactivity \
1649 setactivity_none \
1650 setplevel \
1651 uncheckout \
1652 unlock \
1653 unreserve \
1654 "
1655
1656 if [ $ARCHITECTURE = 'cygwin' ]; then
1657   _arch_policies="\
1658 POLICY_WIN_INT_SNAP \
1659 POLICY_WIN_DEV_SNAP \
1660 "
1661 else
1662   _arch_policies="\
1663 POLICY_UNIX_INT_SNAP \
1664 POLICY_UNIX_DEV_SNAP \
1665 "
1666 fi
1667
1668 _policies="\
1669 $arch_policies \
1670 POLICY_CHPROJECT_UNRESTRICED \
1671 POLICY_DELIVER_REQUIRE_REBASE \
1672 POLICY_DELIVER_NCO_DEVSTR \
1673 POLICY_DELIVER_NOCO_SELACTS \
1674 POLICY_REBASE_CO \
1675 POLICY_INTRAPROJECT_DELIVER_FOUNDATION_CHANGES \
1676 POLICY_INTRAPROJECT_DELIVER_ALLOW_MISSING_TGTCOMPS \
1677 POLICY_INTERPROJECT_DELIVER \
1678 POLICY_INTERPROJECT_DELIVER_FOUNDATION_CHANGES \
1679 POLICY_INTERPROJECT_DELIVER_REQUIRE_TGTCOMP_VISIBIITY \
1680 POLICY_INTERPROJECT_DELIVER_ALLOW_NONMOD_TGTCOMPS \
1681 "
1682
1683 # Helper functions
1684 function set_pvob () {
1685   if [ $# -eq 1 ]; then
1686         pvob=$1
1687   fi
1688 } # set_pvob
1689
1690 function set_dvob () {
1691   if [ $# -eq 1 ]; then
1692         dvob=$1
1693   fi
1694 } # set_dvob
1695
1696 # Listing type functions. These functions produce a list of some object and are
1697 # used by the various completion functions.
1698 function _attypes () {
1699   if [ $# -gt 0 ]; then
1700         scm lstype -kind attype -invob $pvob -fmt "%n " | grep ^$1
1701   else
1702     scm lstype -kind attype -invob $pvob -fmt "%n "
1703   fi
1704 } # _attypes
1705
1706 function _activities () {
1707   if [ $# -gt 0 ]; then
1708         scm lsactivity -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1709   else
1710     scm lsactivity -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1711   fi
1712 } # _activities
1713
1714 function _baselines () {
1715   stream=$(scm lsstream -short 2> /dev/null)
1716   
1717   if [ -z $stream ]; then
1718         return;
1719   fi
1720   
1721   if [ $# -ge 0 ]; then
1722         scm lsbl -stream $stream@$pvob -short | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1723   else 
1724         scm lsbl -stream $stream@$pvob -short | sed "s:$:@$vobtagPrefix$pvob:"
1725   fi
1726 } # _baselines
1727
1728 function _brtypes () {
1729   if [ $# -gt 0 ]; then
1730         scm lstype -kind brtype -invob $pvob -fmt "%n\n" | grep ^$1
1731   else
1732     scm lstype -kind brtype -invob $pvob -fmt "%n\n"
1733   fi
1734 } # _brtypes
1735
1736 function _cchosts () {
1737   registryHost=$(scm hostinfo -long | grep "Registry host:" | awk '{print $NF}')
1738
1739   scm lsclients -short -host $registryHost | tr [:upper:] [:lower:]
1740 } # _cchosts
1741
1742 function _components () {
1743   if [ $# -gt 0 ]; then
1744         scm lscomp -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1745   else
1746         scm lscomp -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1747   fi
1748 } # _components
1749
1750 function _eltypes () {
1751   if [ $# -gt 0 ]; then
1752         scm lstype -kind eltype -invob $pvob -fmt "%n " | grep ^$1
1753   else
1754     scm lstype -kind eltype -invob $pvob -fmt "%n "
1755   fi
1756 } # _eltypes
1757
1758 function _folders () {
1759   if [ $# -gt 0 ]; then
1760         scm lsfolder -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1761   else
1762     scm lsfolder -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1763   fi
1764 } # _folders
1765
1766 function _hltypes () {
1767   if [ $# -gt 0 ]; then
1768         scm lstype -kind hltype -invob $pvob -fmt "%n " | grep ^$1
1769   else
1770     scm lstype -kind hltype -invob $pvob -fmt "%n "
1771   fi
1772 } # _hltypes
1773
1774 function _lbtypes () {
1775   if [ $# -gt 0 ]; then
1776         scm lstype -kind lbtype -invob $pvob -fmt "%n@$vobtagPrefix$pvob " | grep ^$1
1777   else
1778     scm lstype -kind lbtype -invob $pvob -fmt "%n@$vobtagPrefix$pvob "
1779   fi
1780 } # _lbtypes
1781
1782 function _projects () {
1783   if [ $# -gt 0 ]; then
1784         scm lsproject -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1785   else
1786         scm lsproject -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1787   fi    
1788 } # _projects
1789
1790 function _streams () {
1791   if [ $# -gt 0 ]; then
1792         scm lsstream -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1793   else
1794         scm lsstream -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1795   fi
1796 } # _streams
1797
1798 function _stglocs () {
1799   if [ $# -gt 0 ]; then
1800         scm lsstgloc -short | grep ^$1
1801   else
1802         scm lsstgloc -short
1803   fi
1804 } # _stglocs
1805
1806 function _views () {
1807   if [ $# -gt 0 ]; then
1808     scm lsview -short | grep ^$1;
1809   else
1810     scm lsview -short;
1811   fi
1812 } # _views
1813
1814 function _vobs () {
1815   # We simply must rid ourselves of these bloody backlashes!!! And yet Clearcase
1816   # insists on retaining them. Let's strip them off, do our thing, then put them
1817   # back to backslashes when we output stuff.
1818   if [ $ARCHITECTURE = 'cygwin' ]; then
1819         if [ $# -eq 0 ]; then
1820           scm lsvob -short | sed 's:\\:\\\\\\\\:'
1821         else
1822       # Convert to foward slashes
1823       vob=$(echo $1 | sed 's:\\::g')
1824       
1825       scm lsvob -short | sed 's:\\::' | grep ^$vob | sed 's:^:\\\\\\\\:'
1826         fi
1827   else
1828     if [ $# -eq 0 ]; then
1829       scm lsvob -short
1830     else
1831       scm lsvob -short | grep ^$1
1832     fi
1833   fi
1834 } # _vobs
1835
1836 function _trtypes () {
1837   if [ $# -gt 0 ]; then
1838         scm lstype -kind trtype -invob $pvob -fmt "%n " | grep ^$1
1839   else
1840     scm lstype -kind trtype -invob $pvob -fmt "%n "
1841   fi
1842 } # _trtypes
1843
1844 # Completion functions for individual commands where the completion may change
1845 # depending on the operation. For example, typing "scm catcs -tag " should
1846 # now complete based on view tags whereas "scm catcs -" should just complete
1847 # based on options (which are only -help and -tag at this point for this 
1848 # particular command). If a command does not have a "completer function" then
1849 # it will only provide for options completion and will be handled by the general
1850 # _scm completion function.
1851 function _catcs () {
1852   local cur prev
1853   local opts="\
1854 $_global_opts \
1855 -tag \
1856 "
1857   COMPREPLY=()
1858   cur="${COMP_WORDS[COMP_CWORD]}"
1859   prev="${COMP_WORDS[COMP_CWORD-1]}"
1860
1861   if [[ $cur == -* ]]; then
1862     COMPREPLY=($(compgen -W "$opts" -- $cur))
1863   elif [[ $prev == -tag ]]; then
1864         COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
1865   fi
1866 } # _catcs
1867
1868 function _chactivity () {
1869   local cur prev
1870   local opts="\
1871 $_global_opts \
1872 $_comment_opts \
1873 -headline \
1874 -fcset \
1875 -tcset \
1876 -view \
1877 -cqaction \
1878 -cact \
1879 "
1880   COMPREPLY=()
1881   cur="${COMP_WORDS[COMP_CWORD]}"
1882   prev="${COMP_WORDS[COMP_CWORD-1]}"
1883   
1884   if [[ $cur == -* ]]; then
1885     COMPREPLY=($(compgen -W "$opts" -- $cur))
1886   elif [[ $prev == -fcset || $prev == -tcset ]]; then
1887         COMPREPLY=($(compgen -W "$(_activities $cur)"))
1888   elif [[ $prev == -view ]]; then
1889     COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
1890   fi    
1891 } # _chactivity
1892
1893 function _checkin () {
1894   local cur prev prev2
1895   local opts="\
1896 $_global_opts \
1897 $_comment_opts \
1898 -cact \
1899 -cr \
1900 -from \
1901 -identical \
1902 -keep \
1903 -ptime \
1904 -rm \
1905 "
1906   COMPREPLY=()
1907   cur="${COMP_WORDS[COMP_CWORD]}"
1908   prev="${COMP_WORDS[COMP_CWORD-1]}"
1909   prev2="${COMP_WORDS[COMP_CWORD-2]}"
1910   
1911   if [[ $cur == -* ]]; then
1912     COMPREPLY=($(compgen -W "$opts" -- $cur))
1913   elif [[ $prev2 == activity && $prev == : ]]; then
1914         COMPREPLY=($(compgen -W "$(_activities $cur)"))
1915   fi            
1916 } # _checkin
1917
1918 function _checkvob () {
1919   local cur prev
1920   local opts="\
1921 $_global_opts \
1922 -acquire \
1923 -activity \
1924 -cleartext \
1925 -component \
1926 -crm \
1927 -data \
1928 -debris \
1929 -derived \
1930 -fix \
1931 -force \
1932 -from \
1933 -global \
1934 -hlinks \
1935 -hltype \
1936 -ignore \
1937 -lock \
1938 -log \
1939 -pname \
1940 -pool \
1941 -protections \
1942 -setup \
1943 -source \
1944 -to \
1945 -trssize \
1946 -ucm \
1947 -unlock \
1948 -verbose \
1949 -view \
1950 -vob \
1951 "
1952   COMPREPLY=()
1953   cur="${COMP_WORDS[COMP_CWORD]}"
1954   prev="${COMP_WORDS[COMP_CWORD-1]}"
1955
1956   if [[ $cur == -* ]]; then
1957     COMPREPLY=($(compgen -W "$opts" -- $cur))
1958   elif [[ $prev == -view ]]; then
1959     COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
1960   fi                    
1961 } # _checkvob
1962
1963 function _chevent () {
1964   local cur prev
1965   local opts="\
1966 $_global_opts \
1967 $_comment_opts \
1968 -append \
1969 -event \
1970 -insert \
1971 -invob \
1972 -pname \
1973 -replace \
1974 "
1975   COMPREPLY=()
1976   cur="${COMP_WORDS[COMP_CWORD]}"
1977   prev="${COMP_WORDS[COMP_CWORD-1]}"
1978
1979   if [[ $cur == -* ]]; then
1980     COMPREPLY=($(compgen -W "$opts" -- $cur))
1981   elif [[ $prev == -invob ]]; then
1982     COMPREPLY=($(compgen -W "$(_vobs $cur)"))
1983   elif [[ $cur == * ]]; then
1984     COMPREPLY=($(compgen -W "$_object_selectors" -- $cur))
1985   fi
1986 } # _chevent
1987
1988 function _chfolder () {
1989   local cur prev
1990   local opts="\
1991 $_global_opts \
1992 $_comment_opts \
1993 -to \
1994 "
1995   COMPREPLY=()
1996   cur="${COMP_WORDS[COMP_CWORD]}"
1997   prev="${COMP_WORDS[COMP_CWORD-1]}"
1998
1999   if [[ $cur == -* ]]; then
2000     COMPREPLY=($(compgen -W "$opts" -- $cur))
2001   elif [[ $prev == -to ]]; then
2002     COMPREPLY=($(compgen -W "$(_folders $cur)"))
2003   elif [[ $cur == * ]]; then
2004     COMPREPLY=($(compgen -W "$(_folders $cur)"))
2005   fi
2006 } # _chfolder
2007
2008 function _chmaster () {
2009   local cur prev
2010   local opts="\
2011 $_global_opts \
2012 $_comment_opts \
2013 -all \
2014 -default \
2015 -long \
2016 -obsolete_replica \
2017 -override \
2018 -pname \
2019 -stream \
2020 -view \
2021 "
2022   COMPREPLY=()
2023   cur="${COMP_WORDS[COMP_CWORD]}"
2024   prev="${COMP_WORDS[COMP_CWORD-1]}"
2025
2026   if [[ $cur == -* ]]; then
2027     COMPREPLY=($(compgen -W "$opts" -- $cur))
2028   elif [[ $prev == -stream ]]; then
2029     COMPREPLY=($(compgen -W "$(_streams $cur)"))
2030   elif [[ $cur == -view ]]; then
2031     COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2032   fi
2033 } # _chmaster
2034
2035 function _chproject () {
2036   local cur prev
2037   local opts="\
2038 $_global_opts \
2039 $_comment_opts \
2040 -amodcomp \
2041 -blname \
2042 -connection \
2043 -crmenable \
2044 -custom \
2045 -dmodcomp \
2046 -ncrmenable \
2047 -npolicy \
2048 -policy \
2049 -rebase \
2050 -spolicy \
2051 -template \
2052 -to \
2053 "
2054   COMPREPLY=()
2055   cur="${COMP_WORDS[COMP_CWORD]}"
2056   prev="${COMP_WORDS[COMP_CWORD-1]}"
2057
2058   if [[ $cur == -* ]]; then
2059     COMPREPLY=($(compgen -W "$opts" -- $cur))
2060   elif [[ $prev == -amodcomp ||
2061           $prev == -dmodcomp ]]; then
2062     COMPREPLY=($(compgen -W "$(_components $cur)"))
2063   elif [[ $prev == -to ]]; then
2064     COMPREPLY=($(compgen -W "$(_folders $cur)"))
2065   elif [[ $prev == -policy  ||
2066           $prev == -npolicy ||
2067           $prev == -spolicy ]]; then
2068     COMPREPLY=($(compgen -W "$_policies" -- $cur))
2069   elif [[ $cur == * ]]; then
2070     COMPREPLY=($(compgen -W "$(_projects $cur)"))
2071   fi
2072 } # _chproject
2073
2074 function _chstream () {
2075   local cur prev
2076   local opts="\
2077 $_global_opts \
2078 $_comment_opts \
2079 -amodcomp \
2080 -cview \
2081 -default \
2082 -dmodcomp \
2083 -generate \
2084 -npolicy \
2085 -nrecommended \
2086 -ntarget \
2087 -policy \
2088 -recommended \
2089 -target \
2090 -template \
2091 "
2092   COMPREPLY=()
2093   cur="${COMP_WORDS[COMP_CWORD]}"
2094   prev="${COMP_WORDS[COMP_CWORD-1]}"
2095
2096   if [[ $cur == -* ]]; then
2097     COMPREPLY=($(compgen -W "$opts" -- $cur))
2098   elif [[ $prev == -amodcomp ||
2099           $prev == -dmodcomp ]]; then
2100     COMPREPLY=($(compgen -W "$(_components $cur)"))
2101   elif [[ $prev == -policy  ||
2102           $prev == -npolicy ]]; then
2103     COMPREPLY=($(compgen -W "$_policies" -- $cur))
2104   elif [[ $prev == , || $prev == -recommended || $cur == , ]]; then
2105     if [[ $cur == , ]]; then
2106       cur=''
2107     fi
2108     COMPREPLY=($(compgen -W "$(_baselines $cur)"))
2109   elif [[ $prev == -target || $cur == * ]]; then
2110     COMPREPLY=($(compgen -W "$(_streams $cur)"))
2111   fi
2112 } # _chstream
2113
2114 function _chview () {
2115   local cur prev
2116   local opts="\
2117 $_global_opts \
2118 -cachesize \
2119 -cview \
2120 -force \
2121 -nshareable \
2122 -readonly \
2123 -readwrite \
2124 -shareable \
2125 -stream \
2126 "
2127   COMPREPLY=()
2128   cur="${COMP_WORDS[COMP_CWORD]}"
2129   prev="${COMP_WORDS[COMP_CWORD-1]}"
2130
2131   if [[ $cur == -* ]]; then
2132     COMPREPLY=($(compgen -W "$opts" -- $cur))
2133   elif [[ $prev == -stream ]]; then
2134     COMPREPLY=($(compgen -W "$(_streams $cur)"))
2135   elif [[ $prev == * ]]; then
2136     COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2137   fi
2138 } # _chview
2139
2140 function _deliver () {
2141   local cur prev
2142   local opts="\
2143 $_global_opts \
2144 -activities \
2145 -cact \
2146 -complete \
2147 -force \
2148 -gmerge \
2149 -graphical \
2150 -query \
2151 -reset \
2152 -serial \
2153 -stream \
2154 -target \
2155 -to \
2156 "
2157   COMPREPLY=()
2158   cur="${COMP_WORDS[COMP_CWORD]}"
2159   prev="${COMP_WORDS[COMP_CWORD-1]}"
2160
2161   if [[ $cur == -* ]]; then
2162     COMPREPLY=($(compgen -W "$opts" -- $cur))
2163   elif [[ $prev == -stream || $prev == -target ]]; then
2164     COMPREPLY=($(compgen -W "$(_streams $cur)"))
2165   elif [[ $prev == -to ]]; then
2166     COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2167   elif [[ $prev == -activities ]]; then
2168         COMPREPLY=($(compgen -W "$(_activities $cur)"))
2169   fi
2170 } # _deliver
2171
2172 function _describe () {
2173   local cur prev
2174   local opts="\
2175 $_global_opts \
2176 -aattr \
2177 -ahlink \
2178 -alabel \
2179 -aliases \
2180 -all \
2181 -cact \
2182 -cview \
2183 -graphical \
2184 -ihlink \
2185 -local \
2186 -long \
2187 -pname \
2188 -predecessor \
2189 -type \
2190 -version \
2191 "
2192   COMPREPLY=()
2193   cur="${COMP_WORDS[COMP_CWORD]}"
2194   prev="${COMP_WORDS[COMP_CWORD-1]}"
2195
2196   if [[ $cur == -* ]]; then
2197     COMPREPLY=($(compgen -W "$opts" -- $cur))
2198   elif [[ $cur == * ]]; then
2199     COMPREPLY=($(compgen -W "$_object_selectors" -- $cur))
2200   fi
2201 } # _describe
2202
2203 function _dospace () {
2204   local cur prev
2205   local opts="\
2206 $_global_opts \
2207 -before \
2208 -pool \
2209 -references \
2210 -region \
2211 -scrub \
2212 -since \
2213 -size \
2214 -top \
2215 -update \
2216 "
2217   COMPREPLY=()
2218   cur="${COMP_WORDS[COMP_CWORD]}"
2219   prev="${COMP_WORDS[COMP_CWORD-1]}"
2220
2221   if [[ $cur == -* ]]; then
2222     COMPREPLY=($(compgen -W "$opts" -- $cur))
2223   elif [[ $prev == -region ]]; then
2224     COMPREPLY=($(compgen -W "$(lsregions)" -- $cur))
2225   fi
2226 } # _dospace
2227
2228 function _edcs () {
2229   local cur prev
2230   local opts="\
2231 $_global_opts \
2232 -ctime \
2233 -overwrite \
2234 -ptime \
2235 -rename \
2236 -tag \
2237 "
2238   COMPREPLY=()
2239   cur="${COMP_WORDS[COMP_CWORD]}"
2240   prev="${COMP_WORDS[COMP_CWORD-1]}"
2241
2242   if [[ $cur == -* ]]; then
2243     COMPREPLY=($(compgen -W "$opts" -- $cur))
2244   elif [[ $prev == -tag ]]; then
2245     COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2246   fi
2247 } # _edcs
2248
2249 function _endview () {
2250   local cur prev
2251   local opts="\
2252 $_global_opts \
2253 -server \
2254 "
2255   COMPREPLY=()
2256   cur="${COMP_WORDS[COMP_CWORD]}"
2257   prev="${COMP_WORDS[COMP_CWORD-1]}"
2258
2259   if [[ $cur == -* ]]; then
2260     COMPREPLY=($(compgen -W "$opts" -- $cur))
2261   elif [[ $prev == * ]]; then
2262     COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2263   fi
2264 } # _endview
2265
2266 function _file () {
2267   local cur prev
2268   local opts="\
2269 $_global_opts \
2270 -all \
2271 -invob \
2272 "
2273   COMPREPLY=()
2274   cur="${COMP_WORDS[COMP_CWORD]}"
2275   prev="${COMP_WORDS[COMP_CWORD-1]}"
2276
2277   if [[ $cur == -* ]]; then
2278     COMPREPLY=($(compgen -W "$opts" -- $cur))
2279   elif [[ $prev == -invob ]]; then
2280     COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2281   fi
2282 } # _file
2283
2284 function _getlog () {
2285   local cur prev
2286   local opts="\
2287 $_global_opts \
2288 -all \
2289 -around \
2290 -cview \
2291 -full \
2292 -graphical \
2293 -host \
2294 -inquire \
2295 -last \
2296 -since \
2297 -tag \
2298 -vob \
2299 "
2300   COMPREPLY=()
2301   cur="${COMP_WORDS[COMP_CWORD]}"
2302   prev="${COMP_WORDS[COMP_CWORD-1]}"
2303
2304   if [[ $cur == -* ]]; then
2305     COMPREPLY=($(compgen -W "$opts" -- $cur))
2306   elif [[ $prev == -tag || $prev == -target ]]; then
2307     COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2308   elif [[ $prev == -vob ]]; then
2309     COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2310   elif [[ $prev == -host ]]; then
2311     COMPREPLY=($(compgen -W "$(_cchosts)" -- $cur))
2312   fi
2313 } # _getlog
2314
2315 function _hostinfo () {
2316   local cur prev
2317   local opts="\
2318 $_global_opts \
2319 -full \
2320 -long \
2321 -properties \
2322 "
2323   COMPREPLY=()
2324   cur="${COMP_WORDS[COMP_CWORD]}"
2325   prev="${COMP_WORDS[COMP_CWORD-1]}"
2326
2327   if [[ $cur == -* ]]; then
2328     COMPREPLY=($(compgen -W "$opts" -- $cur))
2329   elif [[ $cur == * ]]; then
2330         COMPREPLY=($(compgen -W "$(_cchosts)" -- $cur))
2331   fi
2332 } # _hostinfo
2333
2334 function _lsactivity () {
2335   local cur prev
2336   local opts="\
2337 $_global_opts \
2338 -ancestor \
2339 -cact \
2340 -contrib \
2341 -cview \
2342 -depth \
2343 -fmt \
2344 -fmt \
2345 -in \
2346 -invob \
2347 -long \
2348 -me \
2349 -obsolete \
2350 -recurse \
2351 -short \
2352 -user \
2353 -view \
2354 "
2355   COMPREPLY=()
2356   cur="${COMP_WORDS[COMP_CWORD]}"
2357   prev="${COMP_WORDS[COMP_CWORD-1]}"
2358
2359   if [[ $cur == -* ]]; then
2360     COMPREPLY=($(compgen -W "$opts" -- $cur))
2361   elif [[ $prev == -invob ]]; then
2362     COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2363   elif [[ $prev == -in ]]; then
2364     COMPREPLY=($(compgen -W "$(_streams $cur)"))  
2365   elif [[ $prev == -view ]]; then
2366     COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2367   elif [[ $cur == * ]]; then
2368         COMPREPLY=($(compgen -W "$(_activities $cur)"))
2369   fi
2370 } # _lsactivity
2371
2372 function _lsbl () {
2373   local cur prev
2374   local opts="\
2375 $_global_opts \
2376 -component \
2377 -cview \
2378 -fmt \
2379 -gtlevel \
2380 -level \
2381 -long \
2382 -long \
2383 -ltlevel \
2384 -obsolete \
2385 -recurse \
2386 -short \
2387 -stream \
2388 -tree \
2389 "
2390   COMPREPLY=()
2391   cur="${COMP_WORDS[COMP_CWORD]}"
2392   prev="${COMP_WORDS[COMP_CWORD-1]}"
2393
2394   if [[ $cur == -* ]]; then
2395     COMPREPLY=($(compgen -W "$opts" -- $cur))
2396   elif [[ $prev == -component ]]; then
2397     COMPREPLY=($(compgen -W "$(_components $cur)"))
2398   elif [[ $prev == -stream ]]; then
2399     COMPREPLY=($(compgen -W "$(_streams $cur)"))  
2400   fi
2401 } # _lsbl
2402
2403 function _lsclients () {
2404   local cur prev
2405   local opts="\
2406 $_global_opts \
2407 -host \
2408 -type \
2409 -short \
2410 -long \
2411 "
2412   COMPREPLY=()
2413   cur="${COMP_WORDS[COMP_CWORD]}"
2414   prev="${COMP_WORDS[COMP_CWORD-1]}"
2415
2416   if [[ $cur == -* ]]; then
2417     COMPREPLY=($(compgen -W "$opts" -- $cur))
2418   elif [[ $prev == -host ]]; then
2419         COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
2420   fi
2421 } # _lsclients
2422
2423 function _lscomp () {
2424   local cur prev
2425   local opts="\
2426 $_global_opts \
2427 -fmt \
2428 -invob \
2429 -long \
2430 -obsolete \
2431 -short \
2432 -tree \
2433 "
2434   COMPREPLY=()
2435   cur="${COMP_WORDS[COMP_CWORD]}"
2436   prev="${COMP_WORDS[COMP_CWORD-1]}"
2437
2438   if [[ $cur == -* ]]; then
2439     COMPREPLY=($(compgen -W "$opts" -- $cur))
2440   elif [[ $prev == -invob ]]; then
2441     COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2442   elif [[ $cur == * ]]; then
2443     COMPREPLY=($(compgen -W "$(_components $cur)"))
2444   fi
2445 } # _lscomp
2446
2447 function _lsfolder () {
2448   local cur prev
2449   local opts="\
2450 $_global_opts \
2451 -ancestor \
2452 -cview \
2453 -depth \
2454 -fmt \
2455 -in \
2456 -invob \
2457 -obsolete \
2458 -recurse \
2459 -short \
2460 -tree \
2461 -view \
2462 "
2463   local lopts="$opts -long"
2464   COMPREPLY=()
2465   cur="${COMP_WORDS[COMP_CWORD]}"
2466   prev="${COMP_WORDS[COMP_CWORD-1]}"
2467
2468   if [[ $cur == -* ]]; then
2469         if [[ $prev == -llfolder ]]; then
2470       COMPREPLY=($(compgen -W "$opts" -- $cur))
2471         else
2472       COMPREPLY=($(compgen -W "$lopts" -- $cur))
2473         fi
2474   elif [[ $prev == -invob ]]; then
2475     COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2476   elif [[ $prev == -view ]]; then
2477     COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2478   elif [[ $prev == -in || $cur == * ]]; then
2479     COMPREPLY=($(compgen -W "$(_folders $cur)"))
2480   fi
2481 } # _lsfolder
2482
2483 function _lspool () {
2484   local cur prev
2485   local opts="\
2486 $_global_opts \
2487 -fmt \
2488 -invob \
2489 -long \
2490 -obsolete \
2491 -short \
2492 "
2493   COMPREPLY=()
2494   cur="${COMP_WORDS[COMP_CWORD]}"
2495   prev="${COMP_WORDS[COMP_CWORD-1]}"
2496
2497   if [[ $cur == -* ]]; then
2498     COMPREPLY=($(compgen -W "$opts" -- $cur))
2499   elif [[ $prev == -invob ]]; then
2500     COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2501   fi
2502 } # _lspool
2503
2504 function _lsprivate () {
2505   local cur prev
2506   local opts="\
2507 $_global_opts \
2508 -age \
2509 -co \
2510 -do \
2511 -invob \
2512 -long \
2513 -other \
2514 -short \
2515 -size \
2516 -tag \
2517 "
2518   COMPREPLY=()
2519   cur="${COMP_WORDS[COMP_CWORD]}"
2520   prev="${COMP_WORDS[COMP_CWORD-1]}"
2521
2522   if [[ $cur == -* ]]; then
2523     COMPREPLY=($(compgen -W "$opts" -- $cur))
2524   elif [[ $prev == -tag ]]; then
2525     COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2526   elif [[ $prev == -invob ]]; then
2527     COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2528   fi
2529 } # _lsprivate
2530
2531 function _lsproject () {
2532   local cur prev
2533   local opts="\
2534 $_global_opts \
2535 -ancestor \
2536 -custom \
2537 -cview \
2538 -depth \
2539 -fmt \
2540 -in \
2541 -invob \
2542 -long \
2543 -obsolete \
2544 -recurse \
2545 -short \
2546 -template \
2547 -tree \
2548 -view \
2549 "
2550   COMPREPLY=()
2551   cur="${COMP_WORDS[COMP_CWORD]}"
2552   prev="${COMP_WORDS[COMP_CWORD-1]}"
2553
2554   if [[ $cur == -* ]]; then
2555     COMPREPLY=($(compgen -W "$opts" -- $cur))
2556   elif [[ $prev == -view ]]; then
2557     COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2558   elif [[ $prev == -invob ]]; then
2559     COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2560   elif [[ $prev == -in || $cur == * ]]; then
2561     COMPREPLY=($(compgen -W "$(_folders $cur)"))  
2562   fi
2563 } # _lsproject
2564
2565 function _lsregion () {
2566   local cur prev
2567   local opts="\
2568 $_global_opts \
2569 -long \
2570 -short \
2571 "
2572   COMPREPLY=()
2573   cur="${COMP_WORDS[COMP_CWORD]}"
2574   prev="${COMP_WORDS[COMP_CWORD-1]}"
2575
2576   if [[ $cur == -* ]]; then
2577     COMPREPLY=($(compgen -W "$opts" -- $cur))
2578   elif [[ $prev == * ]]; then
2579     regions=$(scm lsregion -short | grep ^$cur)
2580     COMPREPLY=($(compgen -W "$regions" -- $cur))
2581   fi
2582 } # _lsregion
2583
2584 function _lsstgloc () {
2585   local cur prev
2586   local opts="\
2587 $_global_opts \
2588 -host \
2589 -long \
2590 -region \
2591 -short \
2592 -storage \
2593 -view \
2594 -vob \
2595 "
2596   COMPREPLY=()
2597   cur="${COMP_WORDS[COMP_CWORD]}"
2598   prev="${COMP_WORDS[COMP_CWORD-1]}"
2599
2600   if [[ $cur == -* ]]; then
2601     COMPREPLY=($(compgen -W "$opts" -- $cur))
2602   elif [[ $prev == -region ]]; then
2603     COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
2604   elif [[ $prev == -storage ]]; then
2605     COMPREPLY=($(compgen -W "$(_stglocs $cur)"))
2606   elif [[ $prev == -host ]]; then
2607     _cchosts
2608   fi
2609 } # _lsstgloc
2610
2611 function _lsstream () {
2612   local cur prev
2613   local opts="\
2614 $_global_opts \
2615 -ancestor \
2616 -cview \
2617 -depth \
2618 -fmt \
2619 -in \
2620 -invob \
2621 -obsolete \
2622 -recurse \
2623 -short \
2624 -template \
2625 -tree \
2626 -view \
2627 "
2628   local lopts="$opts -long"
2629   COMPREPLY=()
2630   cur="${COMP_WORDS[COMP_CWORD]}"
2631   prev="${COMP_WORDS[COMP_CWORD-1]}"
2632
2633   if [[ $cur == -* ]]; then
2634         if [[ $prev == llstream ]]; then
2635       COMPREPLY=($(compgen -W "$opts" -- $cur))
2636         else
2637       COMPREPLY=($(compgen -W "$lopts" -- $cur))
2638         fi
2639   elif [[ $prev == -in ]]; then
2640         COMPREPLY=($(compgen -W "$(_projects $cur)"))
2641   elif [[ $prev == -invob ]]; then
2642     COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2643   elif [[ $prev == -view ]]; then
2644     COMPREPLY=($(compgen -W "$(lsviews)"))
2645   elif [[ $cur == * ]]; then
2646     COMPREPLY=($(compgen -W "$(_streams $cur)"))
2647   fi
2648 } # _lsstream
2649
2650 function _lstype () {
2651   local cur prev
2652   local opts="\
2653 $_global_opts \
2654 -fmt \
2655 -graphical \
2656 -invob \
2657 -kind \
2658 -local \
2659 -long \
2660 -nostatus \
2661 -obsolete \
2662 -short \
2663 -unsorted \
2664 "
2665   COMPREPLY=()
2666   cur="${COMP_WORDS[COMP_CWORD]}"
2667   prev="${COMP_WORDS[COMP_CWORD-1]}"
2668
2669   if [[ $cur == -* ]]; then
2670     COMPREPLY=($(compgen -W "$opts" -- $cur))
2671   elif [[ $prev == -kind ]]; then
2672         COMPREPLY=($(compgen -W "$_kinds" -- $cur))
2673   elif [[ $prev == -invob ]]; then
2674     COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2675   elif [[ $cur == * ]]; then
2676     _type_selector
2677   fi
2678 } # _lstype
2679
2680 function _lsview () {
2681   local cur prev
2682   local opts="\
2683 $_global_opts \
2684 -age \
2685 -cview \
2686 -full \
2687 -host \
2688 -properties \
2689 -quick \
2690 -region \
2691 -short \
2692 -storage \
2693 -text \
2694 -uuid \
2695 "
2696   local lopts="$opts -long"
2697   
2698   COMPREPLY=()
2699   cur="${COMP_WORDS[COMP_CWORD]}"
2700   prev="${COMP_WORDS[COMP_CWORD-1]}"
2701
2702   if [[ $cur == -* ]]; then
2703         if [[ $prev == llview ]]; then
2704       COMPREPLY=($(compgen -W "$opts" -- $cur))
2705         else
2706       COMPREPLY=($(compgen -W "$lopts" -- $cur))
2707         fi
2708   elif [[ $prev == -region ]]; then
2709         COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
2710   elif [[ $prev == -host ]]; then
2711     COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
2712   elif [[ $cur == * ]]; then
2713     COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2714   fi
2715 } # _lsview
2716
2717 function _lsvob () {
2718   local cur prev
2719   local opts="\
2720 $_global_opts \
2721 -family \
2722 -graphical \
2723 -host \
2724 -quick \
2725 -region \
2726 -short \
2727 -storage \
2728 -uuid \
2729 "
2730   lopts="$opts -long"
2731   COMPREPLY=()
2732   cur="${COMP_WORDS[COMP_CWORD]}"
2733   prev="${COMP_WORDS[COMP_CWORD-1]}"
2734
2735   if [[ $cur == -* ]]; then
2736     if [[ $prev == llvob ]]; then
2737       COMPREPLY=($(compgen -W "$opts" -- $cur))
2738     else
2739       COMPREPLY=($(compgen -W "$lopts" -- $cur))
2740     fi      
2741   elif [[ $prev == -region ]]; then
2742         COMPREPLY=($(compgen -W "$(_regions $cur)"))
2743   elif [[ $prev == -host ]]; then
2744     COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
2745   elif [[ $cur == * ]]; then
2746     COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2747   fi
2748 } # _lsvob
2749
2750 function _mkactivity () {
2751   local cur prev
2752   local opts="\
2753 $_global_opts \
2754 -force \
2755 -headline \
2756 -in \
2757 -nset \
2758 "
2759   COMPREPLY=()
2760   cur="${COMP_WORDS[COMP_CWORD]}"
2761   prev="${COMP_WORDS[COMP_CWORD-1]}"
2762
2763   if [[ $cur == -* ]]; then
2764     COMPREPLY=($(compgen -W "$opts" -- $cur))
2765   elif [[ $prev == -in ]]; then
2766         COMPREPLY=($(compgen -W "$(_streams $cur)"))
2767   fi
2768 } # _mkactivity
2769
2770 function _mkbl () {
2771   local cur prev
2772   local opts="\
2773 $_global_opts \
2774 -activities \
2775 -adepends \
2776 -all \
2777 -component \
2778 -ddepends \
2779 -full \
2780 -identical \
2781 -import \
2782 -incremental \
2783 -nact \
2784 -nlabel \
2785 -view \
2786 "
2787   COMPREPLY=()
2788   cur="${COMP_WORDS[COMP_CWORD]}"
2789   prev="${COMP_WORDS[COMP_CWORD-1]}"
2790
2791   if [[ $cur == -* ]]; then
2792     COMPREPLY=($(compgen -W "$opts" -- $cur))
2793   elif [[ $prev == -activities ]]; then
2794         COMPREPLY=($(compgen -W "$(_activities $cur)"))
2795   elif [[ $prev == -component   ||
2796           $prev == -adepends_on ||
2797           $prev == -ddepends_on ]]; then
2798         COMPREPLY=($(compgen -W "$(_components $cur)"))
2799   elif [[ $prev == -clone ]]; then
2800         COMPREPLY=($(compgen -W "$(_baselines $cur)"))
2801   elif [[ $prev == -view ]]; then
2802         COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2803   fi
2804 } # _mkbl
2805
2806 function _mkcomp () {
2807   local cur prev
2808   local opts="\
2809 $_global_opts \
2810 -nroot \
2811 -root \
2812 "
2813   COMPREPLY=()
2814   cur="${COMP_WORDS[COMP_CWORD]}"
2815   prev="${COMP_WORDS[COMP_CWORD-1]}"
2816
2817   if [[ $cur == -* ]]; then
2818     COMPREPLY=($(compgen -W "$opts" -- $cur))
2819   elif [[ $cur == * ]]; then
2820         COMPREPLY=($(compgen -W "$(_components $cur)"))
2821   fi
2822 } # _mkcomp
2823
2824 function _mkfolder () {
2825   local cur prev
2826   local opts="\
2827 $_global_opts \
2828 -in \
2829 "
2830   COMPREPLY=()
2831   cur="${COMP_WORDS[COMP_CWORD]}"
2832   prev="${COMP_WORDS[COMP_CWORD-1]}"
2833
2834   if [[ $cur == -* ]]; then
2835     COMPREPLY=($(compgen -W "$opts" -- $cur))
2836   elif [[ $prev == -in || 
2837           $cur  == * ]]; then
2838         COMPREPLY=($(compgen -W "$(_folders $cur)"))
2839   fi
2840 } # _mkfolder
2841
2842 function _mkproject () {
2843   local cur prev
2844   local opts="\
2845 $_global_opts \
2846 -blname \
2847 -connection \
2848 -crmenable \
2849 -custom \
2850 -in \
2851 -modcomp \
2852 -model \
2853 -npolicy \
2854 -policy \
2855 -spolicy \
2856 -template \
2857 "
2858   COMPREPLY=()
2859   cur="${COMP_WORDS[COMP_CWORD]}"
2860   prev="${COMP_WORDS[COMP_CWORD-1]}"
2861
2862   if [[ $cur == -* ]]; then
2863     COMPREPLY=($(compgen -W "$opts" -- $cur))
2864   elif [[ $prev == -modcomp ]]; then
2865         COMPREPLY=($(compgen -W "$(_components $cur)"))
2866   elif [[ $prev == -in ]]; then
2867         COMPREPLY=($(compgen -W "$(_folders $cur)"))
2868   elif [[ $prev == -policy  ||
2869           $prev == -npolicy ||
2870           $prev == -spolicy ]]; then
2871         COMPREPLY=($(compgen -W "$_policies" -- $cur))
2872   fi
2873 } # _mkproject
2874
2875 function _mkregion () {
2876   local cur prev
2877   local opts="\
2878 $_global_opts \
2879 -replace \
2880 -tag \
2881 -tcomment \
2882 "
2883   COMPREPLY=()
2884   cur="${COMP_WORDS[COMP_CWORD]}"
2885   prev="${COMP_WORDS[COMP_CWORD-1]}"
2886
2887   if [[ $cur == -* ]]; then
2888     COMPREPLY=($(compgen -W "$opts" -- $cur))
2889   elif [[ $prev == -tag ]]; then
2890         COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
2891   fi
2892 } # _mkregion
2893
2894 function _mkstgloc () {
2895   local cur prev
2896   local opts="\
2897 $_global_opts \
2898 -comment \
2899 -force \
2900 -gpath \
2901 -host \
2902 -hpath \
2903 -ngpath \
2904 -region \
2905 -view \
2906 -vob \
2907 "
2908   COMPREPLY=()
2909   cur="${COMP_WORDS[COMP_CWORD]}"
2910   prev="${COMP_WORDS[COMP_CWORD-1]}"
2911
2912   if [[ $cur == -* ]]; then
2913     COMPREPLY=($(compgen -W "$opts" -- $cur))
2914   elif [[ $prev == -region ]]; then
2915         COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
2916   elif [[ $prev == -host ]]; then
2917         COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
2918   fi
2919 } # _mkstgloc
2920
2921 function _mkstream () {
2922   local cur prev
2923   local opts="\
2924 $_global_opts \
2925 -amodcomp \
2926 -baseline \
2927 -in \
2928 -integration \
2929 -nc \
2930 -npolicy \
2931 -policy \
2932 -readonly \
2933 -target \
2934 -template \
2935 "
2936   COMPREPLY=()
2937   cur="${COMP_WORDS[COMP_CWORD]}"
2938   prev="${COMP_WORDS[COMP_CWORD-1]}"
2939
2940   if [[ $cur == -* ]]; then
2941     COMPREPLY=($(compgen -W "$opts" -- $cur))
2942   elif [[ $prev == -amodcomp ]]; then
2943         COMPREPLY=($(compgen -W "$(_components $cur)"))
2944   elif [[ $prev == -baseline ]]; then
2945         COMPREPLY=($(compgen -W "$(_baselines $cur)"))
2946   elif [[ $prev == -in ]]; then
2947         COMPREPLY=($(compgen -W "$(_projects $cur)"))
2948   elif [[ $prev == -policy  ||
2949           $prev == -npolicy ]]; then
2950         COMPREPLY=($(compgen -W "$(_policies $cur)" -- $cur))
2951   fi
2952 } # _mkstream
2953
2954 function _mktag () {
2955   local cur prev
2956   local opts="\
2957 $_global_opts \
2958 -gpath \
2959 -host \
2960 -nstart \
2961 -options \
2962 -password \
2963 -public \
2964 -region \
2965 -replace \
2966 -tag \
2967 -tcomment \
2968 -view \
2969 -vob \
2970 "
2971   COMPREPLY=()
2972   cur="${COMP_WORDS[COMP_CWORD]}"
2973   prev="${COMP_WORDS[COMP_CWORD-1]}"
2974   prev2="$(COMP_WORDS[COMP_CWORD-2])"
2975
2976   if [[ $cur == -* ]]; then
2977     COMPREPLY=($(compgen -W "$opts" -- $cur))
2978   elif [[ $prev2 == -view && $prev == "-tag" ]]; then
2979         COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2980   elif [[ $prev2 == -vob && $prev == "-tag" ]]; then
2981         COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2982   elif [[ $prev == -region ]]; then
2983         COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
2984   elif [[ $prev == -host ]]; then
2985         COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
2986   fi
2987 } # _mktag
2988
2989 function _mktrtype () {
2990   local cur prev
2991   local opts="\
2992 $_global_opts \
2993 -activity \
2994 -all \
2995 -attype \
2996 -baseline \
2997 -brtype \
2998 -component \
2999 -eltype \
3000 -execunix \
3001 -execwin \
3002 -folder \
3003 -hltype \
3004 -lbtype \
3005 -mkattr \
3006 -mkhlink \
3007 -mklabel \
3008 -nc \
3009 -nusers \
3010 -postop \
3011 -print \
3012 -project \
3013 -replace \
3014 -stream \
3015 -trtype \
3016 -type \
3017 -ucmobject \
3018 "
3019   COMPREPLY=()
3020   cur="${COMP_WORDS[COMP_CWORD]}"
3021   prev="${COMP_WORDS[COMP_CWORD-1]}"
3022
3023   if [[ $cur == -* ]]; then
3024     COMPREPLY=($(compgen -W "$opts" -- $cur))
3025   elif [[ $prev == -preop ||
3026           $prev == -postopt ]]; then
3027         COMPREPLY=($(compgen -W "$_operation_types" -- $cur))
3028   elif [[ $prev == -project ]]; then
3029         COMPREPLY=($(compgen -W "$(_projects $cur)"))
3030   elif [[ $prev == -stream ]]; then
3031         COMPREPLY=($(compgen -W "$(_streams $cur)"))
3032   elif [[ $prev == -component ]]; then
3033         COMPREPLY=($(compgen -W "$(_components $cur)"))
3034   elif [[ $prev == -folder ]]; then
3035         COMPREPLY=($(compgen -W "$(_folders $cur)"))
3036   elif [[ $prev == -activity ]]; then
3037         COMPREPLY=($(compgen -W "$(_activites $cur)" -- $cur))
3038   elif [[ $prev == -baseline ]]; then
3039         COMPREPLY=($(compgen -W "$(_baselines $cur)"))
3040   elif [[ $prev == -attype ]]; then
3041         COMPREPLY=($(compgen -W "$(_attypes $cur)"))
3042   elif [[ $prev == -brtype ]]; then
3043         COMPREPLY=($(compgen -W "$(_brtypes $cur)"))
3044   elif [[ $prev == -eltype ]]; then
3045         COMPREPLY=($(compgen -W "$(_eltypes $cur)"))
3046   elif [[ $prev == -hltype ]]; then
3047         COMPREPLY=($(compgen -W "$(_hltypes $cur)"))
3048   elif [[ $prev == -lbtype ]]; then
3049         COMPREPLY=($(compgen -W "$(_lbtypes $cur)"))
3050   elif [[ $prev == -trtypes ]]; then
3051         COMPREPLY=($(compgen -W "$(_trtypes $cur)"))
3052   fi
3053 } # _mktrtype
3054
3055 function _mkview () {
3056   local cur prev
3057   local opts="\
3058 $_global_opts \
3059 -auto \
3060 -cachesize \
3061 -colocated \
3062 -gpath \
3063 -host \
3064 -hpath \
3065 -nshareable \
3066 -ptime \
3067 -region \
3068 -shareable \
3069 -snapshot \
3070 -stgloc \
3071 -stream \
3072 -tag \
3073 -tcomment \
3074 -tmode \
3075 -vws \
3076 "
3077   COMPREPLY=()
3078   cur="${COMP_WORDS[COMP_CWORD]}"
3079   prev="${COMP_WORDS[COMP_CWORD-1]}"
3080
3081   if [[ $cur == -* ]]; then
3082     COMPREPLY=($(compgen -W "$opts" -- $cur))
3083   elif [[ $prev == -tag ]]; then
3084         COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3085   elif [[ $prev == -region ]]; then
3086         COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
3087   elif [[ $prev == -stgloc ]]; then
3088         COMPREPLY=($(compgen -W "$(_stglocs $cur)"))
3089   elif [[ $prev == -host ]]; then
3090         COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
3091   fi
3092 } # _mkview
3093
3094 function _mkvob () {
3095   local cur prev
3096   local opts="\
3097 $_global_opts \
3098 -auto \
3099 -gpath \
3100 -host \
3101 -hpath \
3102 -nc \
3103 -nremote \
3104 -options \
3105 -password \
3106 -public \
3107 -region \
3108 -stgloc \
3109 -tag \
3110 -tcomment \
3111 -ucmproject \
3112 "
3113   COMPREPLY=()
3114   cur="${COMP_WORDS[COMP_CWORD]}"
3115   prev="${COMP_WORDS[COMP_CWORD-1]}"
3116
3117   if [[ $cur == -* ]]; then
3118     COMPREPLY=($(compgen -W "$opts" -- $cur))
3119   elif [[ $prev == -tag ]]; then
3120         COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3121   elif [[ $prev == -region ]]; then
3122         COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
3123   elif [[ $prev == -stgloc ]]; then
3124         COMPREPLY=($(compgen -W "$(_stglocs $cur)"))
3125   elif [[ $prev == -host ]]; then
3126         COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
3127   fi
3128 } # _mkvob
3129
3130 function _mount () {
3131   local cur prev
3132   local opts="\
3133 $_global_opts \
3134 -all \
3135 -options \
3136 -persistent \
3137 "
3138   COMPREPLY=()
3139   cur="${COMP_WORDS[COMP_CWORD]}"
3140   prev="${COMP_WORDS[COMP_CWORD-1]}"
3141
3142   if [[ $cur == -* ]]; then
3143     COMPREPLY=($(compgen -W "$opts" -- $cur))
3144   elif [[ $cur == * ]]; then
3145         COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3146   fi
3147 } # _mount
3148
3149 function _rebase () {
3150   local cur prev
3151   local opts="\
3152 $_global_opts \
3153 -abort \
3154 -baseline \
3155 -cancel \
3156 -complete \
3157 -dbaseline \
3158 -force \
3159 -gmerge \
3160 -graphical \
3161 -long \
3162 -ok \
3163 -preview \
3164 -qall \
3165 -qntrivial \
3166 -query \
3167 -recommended \
3168 -resume \
3169 -serial \
3170 -short \
3171 -status \
3172 -stream \
3173 -view \
3174 "
3175   COMPREPLY=()
3176   cur="${COMP_WORDS[COMP_CWORD]}"
3177   prev="${COMP_WORDS[COMP_CWORD-1]}"
3178
3179   if [[ $cur == -* ]]; then
3180     COMPREPLY=($(compgen -W "$opts" -- $cur))
3181   elif [[ $prev == -view ]]; then
3182         COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3183   elif [[ $prev == -stream ]]; then
3184         COMPREPLY=($(compgen -W "$(_streams $cur)"))
3185   elif [[ $prev == -baseline  ||
3186           $prev == -dbaseline ]]; then
3187         COMPREPLY=($(compgen -W "$(_baselines $cur)"))
3188   fi
3189 } # _rebase
3190
3191 function _recoverview () {
3192   local cur prev
3193   local opts="\
3194 $_global_opts \
3195 -directory \
3196 -force \
3197 _synchronize \
3198 -tag \
3199 -vob \
3200 "
3201   COMPREPLY=()
3202   cur="${COMP_WORDS[COMP_CWORD]}"
3203   prev="${COMP_WORDS[COMP_CWORD-1]}"
3204
3205   if [[ $cur == -* ]]; then
3206     COMPREPLY=($(compgen -W "$opts" -- $cur))
3207   elif [[ $prev == -tag ]]; then
3208         COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3209   elif [[ $prev == -vob ]]; then
3210         COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3211   fi
3212 } # _recoverview
3213
3214 function _reformatview () {
3215   local cur prev
3216   local opts="\
3217 $_global_opts \
3218 -dump \
3219 -load \
3220 -tag \
3221 "
3222   COMPREPLY=()
3223   cur="${COMP_WORDS[COMP_CWORD]}"
3224   prev="${COMP_WORDS[COMP_CWORD-1]}"
3225
3226   if [[ $cur == -* ]]; then
3227     COMPREPLY=($(compgen -W "$opts" -- $cur))
3228   elif [[ $prev == -tag ]]; then
3229         COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3230   fi
3231 } # _reformatview
3232
3233 function _reformatvob () {
3234   local cur prev
3235   local opts="\
3236 $_global_opts \
3237 -dump \
3238 -force \
3239 -host \
3240 -hpath \
3241 -load \
3242 -rm \
3243 "
3244   COMPREPLY=()
3245   cur="${COMP_WORDS[COMP_CWORD]}"
3246   prev="${COMP_WORDS[COMP_CWORD-1]}"
3247
3248   if [[ $cur == -* ]]; then
3249     COMPREPLY=($(compgen -W "$opts" -- $cur))
3250   elif [[ $prev == -host ]]; then
3251         COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
3252   fi
3253 } # _reformatvob
3254
3255 function _register () {
3256   local cur prev
3257   local opts="\
3258 $_global_opts \
3259 -host \
3260 -hpath \
3261 -replace \
3262 -ucmproject \
3263 -view \
3264 -vob \
3265 "
3266   COMPREPLY=()
3267   cur="${COMP_WORDS[COMP_CWORD]}"
3268   prev="${COMP_WORDS[COMP_CWORD-1]}"
3269
3270   if [[ $cur == -* ]]; then
3271     COMPREPLY=($(compgen -W "$opts" -- $cur))
3272   elif [[ $prev == -host ]]; then
3273         COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
3274   fi
3275 } # _register
3276
3277 function _rmactivity () {
3278   local cur prev
3279   local opts="\
3280 $_global_opts \
3281 $_comment_opts \
3282 -force \
3283 "
3284   COMPREPLY=()
3285   cur="${COMP_WORDS[COMP_CWORD]}"
3286   prev="${COMP_WORDS[COMP_CWORD-1]}"
3287
3288   if [[ $cur == -* ]]; then
3289     COMPREPLY=($(compgen -W "$opts" -- $cur))
3290   elif [[ $cur == * ]]; then
3291         COMPREPLY=($(compgen -W "$(_activities $cur)"))
3292   fi
3293 } # _rmactivity
3294
3295 function _rmattr () {
3296   local cur prev
3297   local opts="\
3298 $_global_opts \
3299 $_comment_opts \
3300 -recurse \
3301 -version \
3302 "
3303   COMPREPLY=()
3304   cur="${COMP_WORDS[COMP_CWORD]}"
3305   prev="${COMP_WORDS[COMP_CWORD-1]}"
3306
3307   if [[ $cur == -* ]]; then
3308     COMPREPLY=($(compgen -W "$opts" -- $cur))
3309   elif [[ $cur == * ]]; then
3310         COMPREPLY=($(compgen -W "$(_attypes $cur)"))
3311   fi
3312 } # _rmattr
3313
3314 function _rmbl () {
3315   local cur prev
3316   local opts="\
3317 $_global_opts \
3318 $_comment_opts \
3319 -force\
3320 "
3321   COMPREPLY=()
3322   cur="${COMP_WORDS[COMP_CWORD]}"
3323   prev="${COMP_WORDS[COMP_CWORD-1]}"
3324
3325   if [[ $cur == -* ]]; then
3326     COMPREPLY=($(compgen -W "$opts" -- $cur))
3327   elif [[ $cur == * ]]; then
3328         COMPREPLY=($(compgen -W "$(_baselines $cur)"))
3329   fi
3330 } # _rmbl
3331
3332 function _rmcomp () {
3333   local cur prev
3334   local opts="\
3335 $_global_opts \
3336 $_comment_opts \
3337 -force\
3338 "
3339   COMPREPLY=()
3340   cur="${COMP_WORDS[COMP_CWORD]}"
3341   prev="${COMP_WORDS[COMP_CWORD-1]}"
3342
3343   if [[ $cur == -* ]]; then
3344     COMPREPLY=($(compgen -W "$opts" -- $cur))
3345   elif [[ $cur == * ]]; then
3346         COMPREPLY=($(compgen -W "$(_components $cur)"))
3347   fi
3348 } # _rmcomp
3349
3350 function _rmfolder () {
3351   local cur prev
3352   local opts="\
3353 $_global_opts \
3354 $_comment_opts \
3355 -force\
3356 "
3357   COMPREPLY=()
3358   cur="${COMP_WORDS[COMP_CWORD]}"
3359   prev="${COMP_WORDS[COMP_CWORD-1]}"
3360
3361   if [[ $cur == -* ]]; then
3362     COMPREPLY=($(compgen -W "$opts" -- $cur))
3363   elif [[ $cur == * ]]; then
3364         COMPREPLY=($(compgen -W "$(_folders $cur)"))
3365   fi
3366 } # _rmfolder
3367
3368 function _rmhlink () {
3369   local cur prev
3370   local opts="\
3371 $_global_opts \
3372 $_comment_opts \
3373 "
3374   COMPREPLY=()
3375   cur="${COMP_WORDS[COMP_CWORD]}"
3376   prev="${COMP_WORDS[COMP_CWORD-1]}"
3377
3378   if [[ $cur == -* ]]; then
3379     COMPREPLY=($(compgen -W "$opts" -- $cur))
3380   elif [[ $cur == * ]]; then
3381         COMPREPLY=($(compgen -W "$(_hltypes $cur)"))
3382   fi
3383 } # _rmhlink
3384
3385 function _rmlabel () {
3386   local cur prev
3387   local opts="\
3388 $_global_opts \
3389 $_comment_opts \
3390 -follow \
3391 -recurse \
3392 -version \
3393 "
3394   COMPREPLY=()
3395   cur="${COMP_WORDS[COMP_CWORD]}"
3396   prev="${COMP_WORDS[COMP_CWORD-1]}"
3397
3398   if [[ $cur == -* ]]; then
3399     COMPREPLY=($(compgen -W "$opts" -- $cur))
3400   elif [[ $cur == * ]]; then
3401         COMPREPLY=($(compgen -W "$(_lbtypes $cur)"))
3402   fi
3403 } # _rmlabel
3404
3405 function _rmproject () {
3406   local cur prev
3407   local opts="\
3408 $_global_opts \
3409 $_comment_opts \
3410 -force \
3411 -template \
3412 "
3413   COMPREPLY=()
3414   cur="${COMP_WORDS[COMP_CWORD]}"
3415   prev="${COMP_WORDS[COMP_CWORD-1]}"
3416
3417   if [[ $cur == -* ]]; then
3418     COMPREPLY=($(compgen -W "$opts" -- $cur))
3419   elif [[ $cur == * ]]; then
3420         COMPREPLY=($(compgen -W "$(_projects $cur)"))
3421   fi
3422 } # _rmproject
3423
3424 function _rmregion () {
3425   local cur prev
3426   local opts="\
3427 $_global_opts \
3428 -password \
3429 -rmall \
3430 -tag \
3431 "
3432   COMPREPLY=()
3433   cur="${COMP_WORDS[COMP_CWORD]}"
3434   prev="${COMP_WORDS[COMP_CWORD-1]}"
3435
3436   if [[ $cur == -* ]]; then
3437     COMPREPLY=($(compgen -W "$opts" -- $cur))
3438   elif [[ $prev == -tag ]]; then
3439         COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
3440   fi
3441 } # _rmregion
3442
3443 function _rmstgloc () {
3444   local cur prev
3445   local opts="\
3446 $_global_opts \
3447 -all \
3448 -region \
3449 -storage \
3450 "
3451   COMPREPLY=()
3452   cur="${COMP_WORDS[COMP_CWORD]}"
3453   prev="${COMP_WORDS[COMP_CWORD-1]}"
3454
3455   if [[ $cur == -* ]]; then
3456     COMPREPLY=($(compgen -W "$opts" -- $cur))
3457   elif [[ $prev == -region ]]; then
3458         COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
3459   elif [[ $cur == * ]]; then
3460         COMPREPLY=($(compgen -W "$(_stglocs $cur)"))
3461   fi
3462 } # _rmstgloc
3463
3464 function _rmstream () {
3465   local cur prev
3466   local opts="\
3467 $_global_opts \
3468 $_comment_opts \
3469 -force \
3470 -template \
3471 "
3472   COMPREPLY=()
3473   cur="${COMP_WORDS[COMP_CWORD]}"
3474   prev="${COMP_WORDS[COMP_CWORD-1]}"
3475
3476   if [[ $cur == -* ]]; then
3477     COMPREPLY=($(compgen -W "$opts" -- $cur))
3478   elif [[ $cur == * ]]; then
3479         COMPREPLY=($(compgen -W "$(_streams $cur)"))
3480   fi
3481 } # _rmstream
3482
3483 function _rmtag () {
3484   local cur prev
3485   local opts="\
3486 $_global_opts \
3487 -all \
3488 -region \
3489 -view \
3490 -vob \
3491 -password \
3492 "
3493   COMPREPLY=()
3494   cur="${COMP_WORDS[COMP_CWORD]}"
3495   prev="${COMP_WORDS[COMP_CWORD-1]}"
3496
3497   if [[ $cur == -* ]]; then
3498     COMPREPLY=($(compgen -W "$opts" -- $cur))
3499   elif [[ $prev == -view ]]; then
3500         COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3501   elif [[ $prev == -vob ]]; then
3502         COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3503   elif [[ $prev == -region ]]; then
3504         COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
3505   fi
3506 } # _rmtag
3507
3508 function _rmtrigger () {
3509   local cur prev
3510   local opts="\
3511 $_global_opts \
3512 $_comment_opts \
3513 -nattach \
3514 -ninherit \
3515 -recurse \
3516 "
3517   COMPREPLY=()
3518   cur="${COMP_WORDS[COMP_CWORD]}"
3519   prev="${COMP_WORDS[COMP_CWORD-1]}"
3520
3521   if [[ $cur == -* ]]; then
3522     COMPREPLY=($(compgen -W "$opts" -- $cur))
3523   elif [[ $cur == * ]]; then
3524         COMPREPLY=($(compgen -W "$(_trtypes $cur)"))
3525   fi
3526 } # _rmtrigger
3527
3528 function _rmtype () {
3529   local cur prev
3530   local opts="\
3531 $_global_opts \
3532 $_comment_opts \
3533 -force \
3534 -ignore \
3535 -rmall \
3536 "
3537   COMPREPLY=()
3538   cur="${COMP_WORDS[COMP_CWORD]}"
3539   prev="${COMP_WORDS[COMP_CWORD-1]}"
3540
3541   if [[ $cur == -* ]]; then
3542     COMPREPLY=($(compgen -W "$opts" -- $cur))
3543   elif [[ $cur == * ]]; then
3544         _type_selectors
3545   fi
3546 } # _rmtype
3547
3548 function _rmview () {
3549   local cur prev
3550   local opts="\
3551 $_global_opts \
3552 $_comment_opts \
3553 -all \
3554 -avobs \
3555 -force \
3556 -tag \
3557 -vob \
3558 "
3559   COMPREPLY=()
3560   cur="${COMP_WORDS[COMP_CWORD]}"
3561   prev="${COMP_WORDS[COMP_CWORD-1]}"
3562
3563   if [[ $cur == -* ]]; then
3564     COMPREPLY=($(compgen -W "$opts" -- $cur))
3565   elif [[ $prev == -tag ]]; then
3566         COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))          
3567   elif [[ $prev == -vob ]]; then
3568         COMPREPLY=($(compgen -W "$(_vobs $cur)"))       
3569   fi
3570 } # _rmview
3571
3572 function _rmvob () {
3573   local cur prev
3574   local opts="\
3575 $_global_opts \
3576 -force \
3577 "
3578   COMPREPLY=()
3579   cur="${COMP_WORDS[COMP_CWORD]}"
3580   prev="${COMP_WORDS[COMP_CWORD-1]}"
3581
3582   if [[ $cur == -* ]]; then
3583     COMPREPLY=($(compgen -W "$opts" -- $cur))
3584   elif [[ $cur == * ]]; then
3585         COMPREPLY=($(compgen -W "$(_vobs $cur)"))       
3586   fi
3587 } # _rmvob
3588
3589 function _setcs () {
3590   local cur prev
3591   local opts="\
3592 $_global_opts \
3593 -ctime \
3594 -current \
3595 -default \
3596 -force \
3597 -overwrite \
3598 -pname \
3599 -ptime \
3600 -rename \
3601 -stream \
3602 -tag \
3603 "
3604   COMPREPLY=()
3605   cur="${COMP_WORDS[COMP_CWORD]}"
3606   prev="${COMP_WORDS[COMP_CWORD-1]}"
3607
3608   if [[ $cur == -* ]]; then
3609     COMPREPLY=($(compgen -W "$opts" -- $cur))
3610   elif [[ $cur == -tag ]]; then
3611         COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))          
3612   fi
3613 } # _setcs
3614
3615 function _setplevel () {
3616   local cur prev
3617   local opts="\
3618 $_global_opts \
3619 $_comment_opts \
3620 -default \
3621 -invob \
3622 "
3623   COMPREPLY=()
3624   cur="${COMP_WORDS[COMP_CWORD]}"
3625   prev="${COMP_WORDS[COMP_CWORD-1]}"
3626
3627   if [[ $cur == -* ]]; then
3628     COMPREPLY=($(compgen -W "$opts" -- $cur))
3629   elif [[ $prev == -invob ]]; then
3630         COMPREPLY=($(compgen -W "$(_vobs $cur)"))       
3631   fi
3632 } # _setplevel
3633
3634 function _setview() {
3635   local cur prev
3636   local opts="\
3637 $_global_opts \
3638 -login \
3639 -exec \
3640 "
3641   COMPREPLY=()
3642   cur="${COMP_WORDS[COMP_CWORD]}"
3643   prev="${COMP_WORDS[COMP_CWORD-1]}"
3644
3645   if [[ $cur == -* && $ARCHITECTURE != cygwin ]]; then
3646     COMPREPLY=($(compgen -W "$opts" -- $cur))
3647   elif [[ $cur == * ]]; then
3648         COMPREPLY=($(compgen -W "$(_views $cur)"))      
3649   fi
3650 } # _setview
3651
3652 function _space () {
3653   local cur prev
3654   local opts="\
3655 $_global_opts \
3656 -all \
3657 -directory \
3658 -generate \
3659 -host \
3660 -region \
3661 -scrub \
3662 -update \
3663 -view \
3664 -vob \
3665 "
3666   COMPREPLY=()
3667   cur="${COMP_WORDS[COMP_CWORD]}"
3668   prev="${COMP_WORDS[COMP_CWORD-1]}"
3669
3670   if [[ $cur == -* ]]; then
3671     COMPREPLY=($(compgen -W "$opts" -- $cur))
3672   elif [[ $prev == -view ]]; then
3673         COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))          
3674   elif [[ $prev == -vob || $cur == * ]]; then
3675         COMPREPLY=($(compgen -W "$(_vobs $cur)"))       
3676   fi
3677 } # _space
3678
3679 function _startview () {
3680   local cur prev
3681   local opts="\
3682 $_global_opts \
3683 "
3684   COMPREPLY=()
3685   cur="${COMP_WORDS[COMP_CWORD]}"
3686   prev="${COMP_WORDS[COMP_CWORD-1]}"
3687
3688   if [[ $cur == -* ]]; then
3689     COMPREPLY=($(compgen -W "$opts" -- $cur))
3690   elif [[ $cur == * ]]; then
3691         COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))          
3692   fi
3693 } # _startview
3694
3695 function _umount () {
3696   local cur prev
3697   local opts="\
3698 $_global_opts \
3699 -all
3700 "
3701   COMPREPLY=()
3702   cur="${COMP_WORDS[COMP_CWORD]}"
3703   prev="${COMP_WORDS[COMP_CWORD-1]}"
3704
3705   if [[ $cur == -* ]]; then
3706     COMPREPLY=($(compgen -W "$opts" -- $cur))
3707   elif [[ $cur == * ]]; then
3708         COMPREPLY=($(compgen -W "$(_vobs $cur)"))       
3709   fi
3710 } # _umount
3711
3712 function _unlock () {
3713   local cur prev
3714   local opts="\
3715 $_global_opts \
3716 $_comment_opts \
3717 -pname \
3718 -version \
3719 "
3720   COMPREPLY=()
3721   cur="${COMP_WORDS[COMP_CWORD]}"
3722   prev="${COMP_WORDS[COMP_CWORD-1]}"
3723
3724   if [[ $cur == -* ]]; then
3725     COMPREPLY=($(compgen -W "$opts" -- $cur))
3726   elif [[ $cur == * ]]; then
3727         COMPREPLY=($(compgen -W "$(_object_selector $cur)" -- $cur))    
3728   fi
3729 } # _unlock
3730
3731 function _scm () {
3732   local cur prev
3733
3734   COMPREPLY=()
3735   cur="${COMP_WORDS[COMP_CWORD]}"
3736   cmd="${COMP_WORDS[0]}"
3737   subcmd="${COMP_WORDS[1]}"
3738   
3739   if [[ $cmd == scm || $cmd == ct ]]; then
3740         if [[ $COMP_CWORD == 1 ]]; then
3741           COMPREPLY=($(compgen -W "$_scm_cmds" -- $cur))
3742         else
3743       case "$subcmd" in
3744         annotate)
3745           COMPREPLY=($(compgen -W "$_annotate_opts" -- $cur));;
3746         catcr)
3747           COMPREPLY=($(compgen -W "$_catcr_opts" -- $cur));;
3748         catcs)
3749           _catcs;;
3750         chactivity)
3751           _chactivity;;
3752         chbl)
3753           COMPREPLY=($(compgen -W "$_chbl_opts" -- $cur));;
3754         checkin|ci)
3755           _checkin;;
3756         checkout|co)
3757           COMPREPLY=($(compgen -W "$_checkout_opts" -- $cur));;
3758         checkvob)
3759           _checkvob;;
3760         chevent)
3761           _chevent;;
3762         chflevel)
3763           COMPREPLY=($(compgen -W "$_chflevel_opts" -- $cur));;
3764         chfolder)
3765           _chfolder;;
3766         chmaster)
3767           _chmaster;;
3768         chpool)
3769           COMPREPLY=($(compgen -W "$_chpool_opts" -- $cur));;
3770         chproject)
3771           _chproject;;
3772         chstream)
3773           _chstream;;
3774         chtype)
3775           COMPREPLY=($(compgen -W "$_chtype_opts" -- $cur));;
3776         chview)
3777           _chview;;
3778         deliver)
3779           _deliver;;
3780         describe|desc)
3781           _describe;;
3782         diff)
3783           COMPREPLY=($(compgen -W "$_diff_opts" -- $cur));;
3784         diffbl)
3785           COMPREPLY=($(compgen -W "$_diffbl_opts" -- $cur));;
3786         diffcr)
3787           COMPREPLY=($(compgen -W "$_diffcr_opts" -- $cur));;
3788         dospace)
3789           _dospace;;
3790         edcs)
3791           _edcs;;
3792         endview)
3793           _endview;;
3794         file)
3795           _file;;
3796         find)
3797           COMPREPLY=($(compgen -W "$_find_opts" -- $cur));;
3798         findmerge)
3799           COMPREPLY=($(compgen -W "$_findmerge_opts" -- $cur));;
3800         get)
3801           COMPREPLY=($(compgen -W "$_get_opts" -- $cur));;
3802         getcache)
3803           COMPREPLY=($(compgen -W "$_getcache_opts" -- $cur));;
3804         getlog)
3805           _getlog;;
3806         help)
3807           COMPREPLY=($(compgen -W "$_scm_cmds" -- $cur));;
3808         hostinfo)
3809           _hostinfo;;
3810         ln)
3811           COMPREPLY=($(compgen -W "$_ln_opts" -- $cur));;
3812         ls)
3813           COMPREPLY=($(compgen -W "$_ls_opts" -- $cur));;
3814         lsactivity)
3815           _lsactivity;;
3816         lsbl)
3817           _lsbl;;
3818         lscheckout|lsco)
3819           COMPREPLY=($(compgen -W "$_lscheckout_opts" -- $cur));;
3820         lsclients)
3821           lsclients;;
3822         lscomp)
3823           _lscomp;;
3824         lsdo)
3825           COMPREPLY=($(compgen -W "$_lsdo_opts" -- $cur));;
3826         lsfolder)
3827           _lsfolder;;
3828         lshistory)
3829           COMPREPLY=($(compgen -W "$_lshistory_opts" -- $cur));;
3830         lslock)
3831           COMPREPLY=($(compgen -W "$_lslock_opts" -- $cur));;
3832         lsmaster)
3833           COMPREPLY=($(compgen -W "$_lsmaster_opts" -- $cur));;
3834         lspool)
3835           _lspool;;
3836         lsprivate)
3837           _lsprivate;;
3838         lsproject)
3839           _lsproject;;
3840         lsregion)
3841           _lsregion;;
3842         lsreplica)
3843           COMPREPLY=($(compgen -W "$_lsreplica_opts" -- $cur));;
3844         lssite)
3845           COMPREPLY=($(compgen -W "$_lssite_opts" -- $cur));;
3846         lsstgloc)
3847           _lsstgloc;;
3848         lsstream)
3849           _lsstream;;
3850         lstype)
3851           _lstype;;
3852         lsview)
3853           _lsview;;
3854         lsvob)
3855           _lsvob;;
3856         lsvtree|vtree)
3857           COMPREPLY=($(compgen -W "$_lsvtree_opts" -- $cur));;
3858         man)
3859           COMPREPLY=($(compgen -W "$_scm_cmds" -- $cur));;
3860         merge)
3861           COMPREPLY=($(compgen -W "$_merge_opts" -- $cur));;
3862         mkactivity)
3863           _mkactivity;;
3864         mkattr)
3865           COMPREPLY=($(compgen -W "$_mkattr_opts" -- $cur));;
3866         mkattype)
3867           COMPREPLY=($(compgen -W "$_mkattype_opts" -- $cur));;          
3868         mkbl)
3869           _mkbl;;
3870         mkbranch)
3871           COMPREPLY=($(compgen -W "$_mkbranch_opts" -- $cur));;
3872         mkbrtype)
3873           COMPREPLY=($(compgen -W "$_mkbrtype_opts" -- $cur));;
3874         mkcomp)
3875           _mkcomp;;
3876         mkdir)
3877           COMPREPLY=($(compgen -W "$_mkdir_opts" -- $cur));;
3878         mkelem)
3879           COMPREPLY=($(compgen -W "$_mkelem_opts" -- $cur));;
3880         mkeltype)
3881           COMPREPLY=($(compgen -W "$_mkeltype_opts" -- $cur));;
3882         mkfolder)
3883           _mkfolder;;
3884         mkhlink)
3885           COMPREPLY=($(compgen -W "$_mkhlink_opts" -- $cur));;
3886         mkhltype)
3887           COMPREPLY=($(compgen -W "$_mkhltype_opts" -- $cur));;
3888         mklabel)
3889           COMPREPLY=($(compgen -W "$_mklabel_opts" -- $cur));;
3890         mklbtype)
3891           COMPREPLY=($(compgen -W "$_mklbtype_opts" -- $cur));;
3892         mkpool)
3893           COMPREPLY=($(compgen -W "$_mkpool_opts" -- $cur));;
3894         mkproject)
3895           _mkproject;;
3896         mkregion)
3897           _mkregion;;
3898         mkstgloc)
3899           _mkstgloc;;
3900         mkstream)
3901           _mkstream;;
3902         mktag)
3903           _mktag;;
3904         mktrigger)
3905           COMPREPLY=($(compgen -W "$_mktrigger_opts" -- $cur));;
3906         mktrtype)
3907           _mktrtype;;
3908         mkview)
3909           _mkview;;
3910         mkvob)
3911           _mkvob;;
3912         mount)
3913           _mount;;
3914         move)
3915           COMPREPLY=($(compgen -W "$_move_opts" -- $cur));;
3916         protect)
3917           COMPREPLY=($(compgen -W "$_protect_opts" -- $cur));;
3918         protectvob)
3919           COMPREPLY=($(compgen -W "$_protectvob_opts" -- $cur));;
3920         pwd)
3921           COMPREPLY=($(compgen -W "$_pwd_opts" -- $cur));;
3922         pwv)
3923           COMPREPLY=($(compgen -W "$_pwv_opts" -- $cur));;
3924         rebase)
3925           _rebase;;
3926         recoverview)
3927           _recoverview;;
3928         reformatview)
3929           _reformatview;;
3930         reformatvob)
3931           _reformatvob;;
3932         register)
3933           _register;;
3934         relocate)
3935           COMPREPLY=($(compgen -W "$_relocate_opts" -- $cur));;
3936         rename)
3937           COMPREPLY=($(compgen -W "$_rename_opts" -- $cur));;
3938         reqmaster)
3939           COMPREPLY=($(compgen -W "$_reqmaster_opts" -- $cur));;
3940         reserve)
3941           COMPREPLY=($(compgen -W "$_reserve_opts" -- $cur));;
3942         rmactivity)
3943           _rmactivity;;
3944         rmattr)
3945           _rmattr;;
3946         rmbl)
3947           _rmbl;;
3948         rmbranch)
3949           COMPREPLY=($(compgen -W "$_rmbranch_opts" -- $cur));;
3950         rmcomp)
3951           _rmcomp;;
3952         rmdo)
3953           COMPREPLY=($(compgen -W "$_rmdo_opts" -- $cur));;
3954         rmelem)
3955           COMPREPLY=($(compgen -W "$_rmelem_opts" -- $cur));;
3956         rmfolder)
3957           _rmfolder;;
3958         rmhlink)
3959           _rmhlink;;
3960         rmlabel)
3961           _rmlabel;;
3962         rmmerge)
3963           COMPREPLY=($(compgen -W "$_rmmerge_opts" -- $cur));;
3964         rmname)
3965           COMPREPLY=($(compgen -W "$_rmname_opts" -- $cur));;
3966         rmpool)
3967           COMPREPLY=($(compgen -W "$_rmpool_opts" -- $cur));;
3968         rmproject)
3969           _rmproject;;
3970         rmregion)
3971           _rmregion;;
3972         rmstgloc)
3973           _rmstgloc;;
3974         rmstream)
3975           _rmstream;;
3976         rmtag)
3977           _rmtag;;
3978         rmtrigger)
3979           _rmtrigger;;
3980         rmtype)
3981           _rmtype;;
3982         rmver)
3983           COMPREPLY=($(compgen -W "$_rmver_opts" -- $cur));;
3984         rmview)
3985           _rmview;;
3986         rmvob)
3987           _rmvob;;
3988         schedule)
3989           COMPREPLY=($(compgen -W "$_schedule_opts" -- $cur));;
3990         setcache)
3991           COMPREPLY=($(compgen -W "$_setcache_opts" -- $cur));;
3992         setcs)
3993           _setcs;;
3994         setview)
3995           _setview;;
3996         setplevel)
3997           _setplevel;;
3998         setsite)
3999           COMPREPLY=($(compgen -W "$_setsite_opts" -- $cur));;
4000         space)
4001           _space;;
4002         startview)
4003           _startview;;
4004         umount)
4005           _umount;;
4006         uncheckout|unco)
4007           COMPREPLY=($(compgen -W "$_uncheckout_opts" -- $cur));;
4008         unlock)
4009           _unlock;;
4010         unregister)
4011           COMPREPLY=($(compgen -W "$_unregister_opts" -- $cur));;
4012         unreserve)
4013           COMPREPLY=($(compgen -W "$_unreserve_opts" -- $cur));;
4014         update)
4015           COMPREPLY=($(compgen -W "$_update_opts" -- $cur));;
4016         winkin)
4017           COMPREPLY=($(compgen -W "$_winkin_opts" -- $cur));;
4018       esac
4019         fi
4020   fi
4021 } # _scm
4022
4023 # TODO: These functions aren't working very well yet.
4024 function _type_selector () {
4025   local cur prev prev2
4026
4027   cur="${COMP_WORDS[COMP_CWORD]}"
4028
4029   if (($COMP_CWORD - 1 >= 0)); then
4030     prev="${COMP_WORDS[COMP_CWORD-1]}"
4031   fi
4032   
4033   if (($COMP_CWORD - 2 >= 0)); then
4034     prev2="${COMP_WORDS[COMP_CWORD-2]}"
4035   fi
4036
4037   if [[ $prev == : ]]; then
4038         COMPREPLY=($(compgen -W "$(ct lstype -kind $prev2 -short -invob $dvob | grep ^$cur)" -- $cur))  
4039   elif [[ $cur == : ]]; then
4040         COMPREPLY=($(compgen -W "$(ct lstype -kind $prev -short -invob $dvob)"))  
4041   elif [[ $cur == * ]]; then
4042         COMPREPLY=($(compgen -W "$_type_selectors" -- $cur))
4043   fi    
4044 } # _type_selector
4045
4046 function _object_selector () {
4047   local cur prev prev2
4048
4049   COMPREPLY=()
4050
4051   cur="${COMP_WORDS[COMP_CWORD]}"
4052   
4053   if (($COMP_CWORD - 1 >= 0)); then
4054     prev="${COMP_WORDS[COMP_CWORD-1]}"
4055   fi
4056   
4057   if (($COMP_CWORD - 2 >= 0)); then
4058     prev2="${COMP_WORDS[COMP_CWORD-2]}"
4059   fi
4060     
4061   if [[ $prev == activity || ($prev == : && $prev2 == activity) ]]; then
4062         if [[ $cur == : ]]; then
4063           COMPREPLY=($(compgen -W "$(_activities)" -- ""))
4064         else
4065           echo "cur = $cur"
4066           COMPREPLY=($(compgen -W "$(_activities $cur)"))
4067           echo "COMPREPLY = ${COMPREPLY[*]}"
4068         fi
4069   elif [[ $prev == lbtype || ($prev == : && $prev2 == lbtype) ]]; then
4070         if [[ $cur == : ]]; then
4071           COMPREPLY=($(compgen -W "$(_lbtypes)" -- ""))
4072           echo "COMPREPLY = ${COMPREPLY[*]}"
4073         else
4074           echo "cur = $cur"
4075           COMPREPLY=($(compgen -W "$(_lbtypes $cur)"))
4076           echo "COMPREPLY = ${COMPREPLY[*]}"
4077         fi      
4078   elif [[ $cur == * ]] ; then
4079     COMPREPLY=($(compgen -W "$_object_selectors" -- $cur))
4080   fi
4081 } # _object_selector
4082
4083 if [[ $BASH_VERSION = 2.05* || $BASH_VERSION = 4* ]]; then
4084   complete -o default -F _scm scm ct
4085
4086   complete -F _catcs       catcs
4087   complete -F _checkin     ci
4088   complete -F _deliver     deliver
4089   complete -F _endview     endview
4090   complete -F _lsactivity  lsact
4091   complete -F _lsbl        lsbl
4092   complete -F _lsproject   lsproj
4093   complete -F _lsfolder    lsfolder llfolder
4094   complete -F _lsstgloc    lsstgloc
4095   complete -F _lsstream    lsstream llstream
4096   complete -F _lsview      lsview llview
4097   complete -F _lsvob       lsvob llvob
4098   complete -F _merge       merge
4099   complete -F _mktag       mktag
4100   complete -F _mkview      mkview
4101   complete -F _rebase      rebase
4102   complete -F _rmtag       rmtag
4103   complete -F _rmview      rmview
4104   complete -F _setactivity setact
4105   complete -F _setcs       setcs
4106   complete -F _setview     setview
4107   complete -F _startview   startview
4108   complete -F _space       space
4109   complete -F _register    register
4110   complete -F _uncheckout  unco
4111   complete -F _unregister  unregister
4112 else
4113   : echo 'Clearcase command completion broken on old Sun Bash shells'
4114 fi
4115   
4116 if [[ $BASH_VERSION = 4* ]]; then
4117   complete -F _object_selector -o nospace lstype
4118   complete -F _object_selector -o nospace lltype
4119   complete -F _object_selector -o nospace lslock
4120   complete -F _object_selector -o nospace lllock
4121 elif [[ $BASH_VERSION = 2.05* ]]; then
4122   complete -F _object_selector lstype
4123   complete -F _object_selector lltype
4124   complete -F _object_selector lslock
4125   complete -F _object_selector lllock
4126   #echo 'Clearcase command completion partially broken on old Sun Bash shells'
4127 fi