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