2 ################################################################################
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 .
9 # Author: Andrew@DeFaria.com
10 # Created: Wed Jun 5 21:08:03 PDT 1996
11 # Modified: $Date: 2011/10/24 18:07:05 $
14 # (c) Copyright 2000-2011, ClearSCM, Inc., all rights reserved.
16 ################################################################################
17 # Set ARCHITECTURE of the machine
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
30 export ARCHITECTURE=''
31 echo "Warning: Unknown architecture ($KERNEL)"
34 if [ $ARCHITECTURE = 'cygwin' ]; then
35 export CCHOME=$(cygpath -u "$(regtool get '/machine/SOFTWARE/Rational Software/RSINSTALLDIR' 2>/dev/null)"/Clearcase 2>/dev/null);
37 export CCHOME="/opt/rational/clearcase"
40 if [ ! -d "$CCHOME" ]; then
45 # Source in clearcase.conf
46 if [ -f ~/.rc/clearcase.conf ]; then
47 source ~/.rc/clearcase.conf
49 echo "WARNING: Could not find ~/.rc/clearcase.conf - functionality will be limted"
52 export CLEARTOOL="$CCHOME/bin/cleartool"
53 export CLEARCASE_BLD_HOST_TYPE="unix"
55 if [ -f "$CCHOME/etc/utils/creds" ]; then
56 if [ $ARCHITECTURE = 'cygwin' ]; then
57 alias creds=$(cygpath "$CCHOME/etc/utils/creds")
59 alias creds="$CCHOME/etc/utils/creds"
63 if [ -x "$CLEARTOOL" ]; then
64 export RGY="$CCHOME/var/atria/rgy"
65 export LOGS="$CCHOME/var/log"
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
77 "$CLEARTOOL" "$@" | tr -d "\015"
92 # Setview is special - there is no setview on Windows. But we approximate it
93 # with the function setview
94 if [ "$1" = "setview" ]; then
105 if [ "$(scm pwv)" != '' ]; then
107 elif [ -f CVS/Root ]; then
116 echo "ci: Error: No files specified"
124 echo "co: Error: No files specified"
132 echo "unco: Error: No files specified"
143 scm lslock -long "$@"
146 # View related functions
148 if [ $ARCHITECTURE = 'cygwin' ]; then
149 if [[ $1 = -* ]]; then
150 echo "The setview command with options is not supported on Windows"
154 # Save off where we are
164 # Setup $VOBTAG_PREFIX
165 mount -f -o binary M:/$1 $LINUX_VOBTAG_PREFIX
170 # Remove $LINUX_VOBTAG_PREFIX mount (Ignore errors)
171 umount $LINUX_VOBTAG_PREFIX 2> /dev/null
173 # Chdir back to were we started
194 scm endview -server "$@"
203 echo "Usage: $FUNCNAME <stream>"
209 # Check to see if the view already exists
210 scm lsview -short ${USER}_$stream > /dev/null 2>&1
213 echo "${USER}_$stream already exists!"
215 mkview -tag ${USER}_$stream -stream $stream@$pvob -stgloc -auto
218 echo "Couldn't find that stream. Perhaps it's one of these?"
220 searchFor=${stream:1:$i}
221 scm lsstream -short -invob $pvob | grep $searchFor | $PAGER
226 setview ${USER}_$stream
235 scm lsview -s | $PAGER
236 elif [ $# = 1 ]; then
237 scm lsview -s | grep "$1"
244 # Well they asked for my "views"...
245 if [ $(whence fortune) ]; then
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)
254 if [ "$headline" = "" ]; then
255 headline="<no activity set>"
258 echo -e "$view\t$headline"
264 scm lsview -long | $PAGER
266 scm lsview -long "$@"
274 scm lsview -short | grep $1
278 # Vob related functions
282 elif [ $# = 1 ]; then
283 scm lsvob | grep "$1"
291 scm lsvob -long | $PAGER
301 scm lsvob -short | grep $1
305 # Config spec functions
342 elif [ $# == 1 ]; then
346 echo "Usage: oid2name: <oid> [<pvob>]"
351 scm describe oid:$oid@$projvob 2> /dev/null | head -1
359 elif [ $# == 2 ]; then
364 echo "Usage: name2oid: <type> <name> [<pvob>]"
369 scm dump $type:$name@$projvob 2> /dev/null | grep oid=
375 echo "vtree: Error: Must specify an element to view its version tree"
377 if [ $ARCHITECTURE = 'cygwin' ]; then
394 scmsystem; scmtype=$?
397 if [ $scmtype = 1 ]; then
398 scm diff -graphical -pred $1
399 elif [ $scmtype = 2 ]; then
403 if [ $scmtype = 1 ]; then
404 scm diff -graphical "$@"
405 elif [ $scmtype = 2 ]; then
413 scm xdiff -vstack -pred $1
419 # Administrative functions
428 function unregister {
432 # Information functions
441 scm lstype trtype:$trig_name@$vob
443 scm lstype -kind trtype "$@" | $PAGER
449 scm lstype -long trtype:$1
451 scm lstype -long -kind trtype "$@"| $PAGER
463 # UCM oriented functions
466 # If we are in a view context then try to list the stream for our view
467 if [[ $(pwv) == "** NONE **" ]]; then
470 scm lsstream | $PAGER
473 # Check to see if a pvob was specified
474 if [[ $@ == *@* ]]; then
477 scm lsstream -invob $pvob | grep $1 | $PAGER
484 scm lsstream -l | $PAGER
492 scm lsstream -short -invob $pvob
494 scm lsstream -short "$@"
498 function lsregions () {
499 if [ $# -gt 0 ]; then
500 scm lsregion -short | grep ^$1
524 scm lsproject | $PAGER
532 scm lsproject -l | $PAGER
534 scm lsproject -l "$@"
543 scm lsfolder -long "$@"
548 scm lsstgloc | $PAGER
556 scm lsstgloc -l | $PAGER
564 scm lsactivity | $PAGER
572 scm lsactivity -l | $PAGER
574 scm lsactivity -l "$@"
580 echo "What? Am I suppose to guess?!?"
588 scmsystem; scmtype=$?
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
601 # Bash completion for Clearcase commands. T
603 # Add "," to COMP_BREAKWORDS
604 COMP_WORDBREAKS=\ \"\'\>\<\=\;\|\&\(\:\,
606 # All Clearcase commands
773 # These options are common to all scm commands. So far -help is the only one
777 # Comment opts. These options are common for commands that request the user
786 # Individual command options
1503 _setactivity_opts="\
1593 _object_selectors="\
1670 if [ $ARCHITECTURE = 'cygwin' ]; then
1672 POLICY_WIN_INT_SNAP \
1673 POLICY_WIN_DEV_SNAP \
1677 POLICY_UNIX_INT_SNAP \
1678 POLICY_UNIX_DEV_SNAP \
1684 POLICY_CHPROJECT_UNRESTRICED \
1685 POLICY_DELIVER_REQUIRE_REBASE \
1686 POLICY_DELIVER_NCO_DEVSTR \
1687 POLICY_DELIVER_NOCO_SELACTS \
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 \
1698 function set_pvob () {
1699 if [ $# -eq 1 ]; then
1704 function set_dvob () {
1705 if [ $# -eq 1 ]; then
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
1716 scm lstype -kind attype -invob $pvob -fmt "%n "
1720 function _activities () {
1721 if [ $# -gt 0 ]; then
1722 scm lsactivity -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1724 scm lsactivity -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1728 function _baselines () {
1729 stream=$(scm lsstream -short 2> /dev/null)
1731 if [ -z $stream ]; then
1735 if [ $# -ge 0 ]; then
1736 scm lsbl -stream $stream@$pvob -short | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1738 scm lsbl -stream $stream@$pvob -short | sed "s:$:@$vobtagPrefix$pvob:"
1742 function _brtypes () {
1743 if [ $# -gt 0 ]; then
1744 scm lstype -kind brtype -invob $pvob -fmt "%n\n" | grep ^$1
1746 scm lstype -kind brtype -invob $pvob -fmt "%n\n"
1750 function _cchosts () {
1751 registryHost=$(scm hostinfo -long | grep "Registry host:" | awk '{print $NF}')
1753 scm lsclients -short -host $registryHost | tr [:upper:] [:lower:]
1756 function _components () {
1757 if [ $# -gt 0 ]; then
1758 scm lscomp -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1760 scm lscomp -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1764 function _eltypes () {
1765 if [ $# -gt 0 ]; then
1766 scm lstype -kind eltype -invob $pvob -fmt "%n " | grep ^$1
1768 scm lstype -kind eltype -invob $pvob -fmt "%n "
1772 function _folders () {
1773 if [ $# -gt 0 ]; then
1774 scm lsfolder -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1776 scm lsfolder -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1780 function _hltypes () {
1781 if [ $# -gt 0 ]; then
1782 scm lstype -kind hltype -invob $pvob -fmt "%n " | grep ^$1
1784 scm lstype -kind hltype -invob $pvob -fmt "%n "
1788 function _lbtypes () {
1789 if [ $# -gt 0 ]; then
1790 scm lstype -kind lbtype -invob $pvob -fmt "%n@$vobtagPrefix$pvob " | grep ^$1
1792 scm lstype -kind lbtype -invob $pvob -fmt "%n@$vobtagPrefix$pvob "
1796 function _projects () {
1797 if [ $# -gt 0 ]; then
1798 scm lsproject -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1800 scm lsproject -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1804 function _streams () {
1805 if [ $# -gt 0 ]; then
1806 scm lsstream -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1808 scm lsstream -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1812 function _stglocs () {
1813 if [ $# -gt 0 ]; then
1814 scm lsstgloc -short | grep ^$1
1820 function _views () {
1821 if [ $# -gt 0 ]; then
1822 scm lsview -short | grep ^$1;
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:\\:\\\\\\\\:'
1836 # Convert to foward slashes
1837 vob=$(echo $1 | sed 's:\\::g')
1839 scm lsvob -short | sed 's:\\::' | grep ^$vob | sed 's:^:\\\\\\\\:'
1842 if [ $# -eq 0 ]; then
1845 scm lsvob -short | grep ^$1
1850 function _trtypes () {
1851 if [ $# -gt 0 ]; then
1852 scm lstype -kind trtype -invob $pvob -fmt "%n " | grep ^$1
1854 scm lstype -kind trtype -invob $pvob -fmt "%n "
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 () {
1872 cur="${COMP_WORDS[COMP_CWORD]}"
1873 prev="${COMP_WORDS[COMP_CWORD-1]}"
1875 if [[ $cur == -* ]]; then
1876 COMPREPLY=($(compgen -W "$opts" -- $cur))
1877 elif [[ $prev == -tag ]]; then
1878 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
1882 function _chactivity () {
1895 cur="${COMP_WORDS[COMP_CWORD]}"
1896 prev="${COMP_WORDS[COMP_CWORD-1]}"
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))
1907 function _checkin () {
1908 local cur prev prev2
1921 cur="${COMP_WORDS[COMP_CWORD]}"
1922 prev="${COMP_WORDS[COMP_CWORD-1]}"
1923 prev2="${COMP_WORDS[COMP_CWORD-2]}"
1925 if [[ $cur == -* ]]; then
1926 COMPREPLY=($(compgen -W "$opts" -- $cur))
1927 elif [[ $prev2 == activity && $prev == : ]]; then
1928 COMPREPLY=($(compgen -W "$(_activities $cur)"))
1932 function _checkvob () {
1967 cur="${COMP_WORDS[COMP_CWORD]}"
1968 prev="${COMP_WORDS[COMP_CWORD-1]}"
1970 if [[ $cur == -* ]]; then
1971 COMPREPLY=($(compgen -W "$opts" -- $cur))
1972 elif [[ $prev == -view ]]; then
1973 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
1977 function _chevent () {
1990 cur="${COMP_WORDS[COMP_CWORD]}"
1991 prev="${COMP_WORDS[COMP_CWORD-1]}"
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))
2002 function _chfolder () {
2010 cur="${COMP_WORDS[COMP_CWORD]}"
2011 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
2022 function _chmaster () {
2037 cur="${COMP_WORDS[COMP_CWORD]}"
2038 prev="${COMP_WORDS[COMP_CWORD-1]}"
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))
2049 function _chproject () {
2069 cur="${COMP_WORDS[COMP_CWORD]}"
2070 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
2088 function _chstream () {
2107 cur="${COMP_WORDS[COMP_CWORD]}"
2108 prev="${COMP_WORDS[COMP_CWORD-1]}"
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
2122 COMPREPLY=($(compgen -W "$(_baselines $cur)"))
2123 elif [[ $prev == -target || $cur == * ]]; then
2124 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2128 function _chview () {
2142 cur="${COMP_WORDS[COMP_CWORD]}"
2143 prev="${COMP_WORDS[COMP_CWORD-1]}"
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))
2154 function _deliver () {
2172 cur="${COMP_WORDS[COMP_CWORD]}"
2173 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
2186 function _describe () {
2207 cur="${COMP_WORDS[COMP_CWORD]}"
2208 prev="${COMP_WORDS[COMP_CWORD-1]}"
2210 if [[ $cur == -* ]]; then
2211 COMPREPLY=($(compgen -W "$opts" -- $cur))
2212 elif [[ $cur == * ]]; then
2213 COMPREPLY=($(compgen -W "$_object_selectors" -- $cur))
2217 function _dospace () {
2232 cur="${COMP_WORDS[COMP_CWORD]}"
2233 prev="${COMP_WORDS[COMP_CWORD-1]}"
2235 if [[ $cur == -* ]]; then
2236 COMPREPLY=($(compgen -W "$opts" -- $cur))
2237 elif [[ $prev == -region ]]; then
2238 COMPREPLY=($(compgen -W "$(lsregions)" -- $cur))
2253 cur="${COMP_WORDS[COMP_CWORD]}"
2254 prev="${COMP_WORDS[COMP_CWORD-1]}"
2256 if [[ $cur == -* ]]; then
2257 COMPREPLY=($(compgen -W "$opts" -- $cur))
2258 elif [[ $prev == -tag ]]; then
2259 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2263 function _endview () {
2270 cur="${COMP_WORDS[COMP_CWORD]}"
2271 prev="${COMP_WORDS[COMP_CWORD-1]}"
2273 if [[ $cur == -* ]]; then
2274 COMPREPLY=($(compgen -W "$opts" -- $cur))
2275 elif [[ $prev == * ]]; then
2276 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2288 cur="${COMP_WORDS[COMP_CWORD]}"
2289 prev="${COMP_WORDS[COMP_CWORD-1]}"
2291 if [[ $cur == -* ]]; then
2292 COMPREPLY=($(compgen -W "$opts" -- $cur))
2293 elif [[ $prev == -invob ]]; then
2294 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2298 function _getlog () {
2315 cur="${COMP_WORDS[COMP_CWORD]}"
2316 prev="${COMP_WORDS[COMP_CWORD-1]}"
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))
2329 function _hostinfo () {
2338 cur="${COMP_WORDS[COMP_CWORD]}"
2339 prev="${COMP_WORDS[COMP_CWORD-1]}"
2341 if [[ $cur == -* ]]; then
2342 COMPREPLY=($(compgen -W "$opts" -- $cur))
2343 elif [[ $cur == * ]]; then
2344 COMPREPLY=($(compgen -W "$(_cchosts)" -- $cur))
2348 function _lsactivity () {
2370 cur="${COMP_WORDS[COMP_CWORD]}"
2371 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
2405 cur="${COMP_WORDS[COMP_CWORD]}"
2406 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
2417 function _lsclients () {
2427 cur="${COMP_WORDS[COMP_CWORD]}"
2428 prev="${COMP_WORDS[COMP_CWORD-1]}"
2430 if [[ $cur == -* ]]; then
2431 COMPREPLY=($(compgen -W "$opts" -- $cur))
2432 elif [[ $prev == -host ]]; then
2433 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
2437 function _lscomp () {
2449 cur="${COMP_WORDS[COMP_CWORD]}"
2450 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
2461 function _lsfolder () {
2477 local lopts="$opts -long"
2479 cur="${COMP_WORDS[COMP_CWORD]}"
2480 prev="${COMP_WORDS[COMP_CWORD-1]}"
2482 if [[ $cur == -* ]]; then
2483 if [[ $prev == -llfolder ]]; then
2484 COMPREPLY=($(compgen -W "$opts" -- $cur))
2486 COMPREPLY=($(compgen -W "$lopts" -- $cur))
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)"))
2497 function _lspool () {
2508 cur="${COMP_WORDS[COMP_CWORD]}"
2509 prev="${COMP_WORDS[COMP_CWORD-1]}"
2511 if [[ $cur == -* ]]; then
2512 COMPREPLY=($(compgen -W "$opts" -- $cur))
2513 elif [[ $prev == -invob ]]; then
2514 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2518 function _lsprivate () {
2533 cur="${COMP_WORDS[COMP_CWORD]}"
2534 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
2545 function _lsproject () {
2565 cur="${COMP_WORDS[COMP_CWORD]}"
2566 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
2579 function _lsregion () {
2587 cur="${COMP_WORDS[COMP_CWORD]}"
2588 prev="${COMP_WORDS[COMP_CWORD-1]}"
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))
2598 function _lsstgloc () {
2611 cur="${COMP_WORDS[COMP_CWORD]}"
2612 prev="${COMP_WORDS[COMP_CWORD-1]}"
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
2625 function _lsstream () {
2642 local lopts="$opts -long"
2644 cur="${COMP_WORDS[COMP_CWORD]}"
2645 prev="${COMP_WORDS[COMP_CWORD-1]}"
2647 if [[ $cur == -* ]]; then
2648 if [[ $prev == llstream ]]; then
2649 COMPREPLY=($(compgen -W "$opts" -- $cur))
2651 COMPREPLY=($(compgen -W "$lopts" -- $cur))
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)"))
2664 function _lstype () {
2680 cur="${COMP_WORDS[COMP_CWORD]}"
2681 prev="${COMP_WORDS[COMP_CWORD-1]}"
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
2694 function _lsview () {
2710 local lopts="$opts -long"
2713 cur="${COMP_WORDS[COMP_CWORD]}"
2714 prev="${COMP_WORDS[COMP_CWORD-1]}"
2716 if [[ $cur == -* ]]; then
2717 if [[ $prev == llview ]]; then
2718 COMPREPLY=($(compgen -W "$opts" -- $cur))
2720 COMPREPLY=($(compgen -W "$lopts" -- $cur))
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))
2731 function _lsvob () {
2746 cur="${COMP_WORDS[COMP_CWORD]}"
2747 prev="${COMP_WORDS[COMP_CWORD-1]}"
2749 if [[ $cur == -* ]]; then
2750 if [[ $prev == llvob ]]; then
2751 COMPREPLY=($(compgen -W "$opts" -- $cur))
2753 COMPREPLY=($(compgen -W "$lopts" -- $cur))
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)"))
2764 function _mkactivity () {
2774 cur="${COMP_WORDS[COMP_CWORD]}"
2775 prev="${COMP_WORDS[COMP_CWORD-1]}"
2777 if [[ $cur == -* ]]; then
2778 COMPREPLY=($(compgen -W "$opts" -- $cur))
2779 elif [[ $prev == -in ]]; then
2780 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2802 cur="${COMP_WORDS[COMP_CWORD]}"
2803 prev="${COMP_WORDS[COMP_CWORD-1]}"
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))
2820 function _mkcomp () {
2828 cur="${COMP_WORDS[COMP_CWORD]}"
2829 prev="${COMP_WORDS[COMP_CWORD-1]}"
2831 if [[ $cur == -* ]]; then
2832 COMPREPLY=($(compgen -W "$opts" -- $cur))
2833 elif [[ $cur == * ]]; then
2834 COMPREPLY=($(compgen -W "$(_components $cur)"))
2838 function _mkfolder () {
2845 cur="${COMP_WORDS[COMP_CWORD]}"
2846 prev="${COMP_WORDS[COMP_CWORD-1]}"
2848 if [[ $cur == -* ]]; then
2849 COMPREPLY=($(compgen -W "$opts" -- $cur))
2850 elif [[ $prev == -in ||
2852 COMPREPLY=($(compgen -W "$(_folders $cur)"))
2856 function _mkproject () {
2873 cur="${COMP_WORDS[COMP_CWORD]}"
2874 prev="${COMP_WORDS[COMP_CWORD-1]}"
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))
2889 function _mkregion () {
2898 cur="${COMP_WORDS[COMP_CWORD]}"
2899 prev="${COMP_WORDS[COMP_CWORD-1]}"
2901 if [[ $cur == -* ]]; then
2902 COMPREPLY=($(compgen -W "$opts" -- $cur))
2903 elif [[ $prev == -tag ]]; then
2904 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
2908 function _mkstgloc () {
2923 cur="${COMP_WORDS[COMP_CWORD]}"
2924 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
2935 function _mkstream () {
2951 cur="${COMP_WORDS[COMP_CWORD]}"
2952 prev="${COMP_WORDS[COMP_CWORD-1]}"
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))
2968 function _mktag () {
2986 cur="${COMP_WORDS[COMP_CWORD]}"
2987 prev="${COMP_WORDS[COMP_CWORD-1]}"
2988 prev2="$(COMP_WORDS[COMP_CWORD-2])"
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)"))
3003 function _mktrtype () {
3034 cur="${COMP_WORDS[COMP_CWORD]}"
3035 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
3069 function _mkview () {
3092 cur="${COMP_WORDS[COMP_CWORD]}"
3093 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
3108 function _mkvob () {
3128 cur="${COMP_WORDS[COMP_CWORD]}"
3129 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
3144 function _mount () {
3153 cur="${COMP_WORDS[COMP_CWORD]}"
3154 prev="${COMP_WORDS[COMP_CWORD-1]}"
3156 if [[ $cur == -* ]]; then
3157 COMPREPLY=($(compgen -W "$opts" -- $cur))
3158 elif [[ $cur == * ]]; then
3159 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3163 function _rebase () {
3190 cur="${COMP_WORDS[COMP_CWORD]}"
3191 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
3205 function _recoverview () {
3216 cur="${COMP_WORDS[COMP_CWORD]}"
3217 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
3228 function _reformatview () {
3237 cur="${COMP_WORDS[COMP_CWORD]}"
3238 prev="${COMP_WORDS[COMP_CWORD-1]}"
3240 if [[ $cur == -* ]]; then
3241 COMPREPLY=($(compgen -W "$opts" -- $cur))
3242 elif [[ $prev == -tag ]]; then
3243 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3247 function _reformatvob () {
3259 cur="${COMP_WORDS[COMP_CWORD]}"
3260 prev="${COMP_WORDS[COMP_CWORD-1]}"
3262 if [[ $cur == -* ]]; then
3263 COMPREPLY=($(compgen -W "$opts" -- $cur))
3264 elif [[ $prev == -host ]]; then
3265 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
3269 function _register () {
3281 cur="${COMP_WORDS[COMP_CWORD]}"
3282 prev="${COMP_WORDS[COMP_CWORD-1]}"
3284 if [[ $cur == -* ]]; then
3285 COMPREPLY=($(compgen -W "$opts" -- $cur))
3286 elif [[ $prev == -host ]]; then
3287 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
3291 function _rmactivity () {
3299 cur="${COMP_WORDS[COMP_CWORD]}"
3300 prev="${COMP_WORDS[COMP_CWORD-1]}"
3302 if [[ $cur == -* ]]; then
3303 COMPREPLY=($(compgen -W "$opts" -- $cur))
3304 elif [[ $cur == * ]]; then
3305 COMPREPLY=($(compgen -W "$(_activities $cur)"))
3309 function _rmattr () {
3318 cur="${COMP_WORDS[COMP_CWORD]}"
3319 prev="${COMP_WORDS[COMP_CWORD-1]}"
3321 if [[ $cur == -* ]]; then
3322 COMPREPLY=($(compgen -W "$opts" -- $cur))
3323 elif [[ $cur == * ]]; then
3324 COMPREPLY=($(compgen -W "$(_attypes $cur)"))
3336 cur="${COMP_WORDS[COMP_CWORD]}"
3337 prev="${COMP_WORDS[COMP_CWORD-1]}"
3339 if [[ $cur == -* ]]; then
3340 COMPREPLY=($(compgen -W "$opts" -- $cur))
3341 elif [[ $cur == * ]]; then
3342 COMPREPLY=($(compgen -W "$(_baselines $cur)"))
3346 function _rmcomp () {
3354 cur="${COMP_WORDS[COMP_CWORD]}"
3355 prev="${COMP_WORDS[COMP_CWORD-1]}"
3357 if [[ $cur == -* ]]; then
3358 COMPREPLY=($(compgen -W "$opts" -- $cur))
3359 elif [[ $cur == * ]]; then
3360 COMPREPLY=($(compgen -W "$(_components $cur)"))
3364 function _rmfolder () {
3372 cur="${COMP_WORDS[COMP_CWORD]}"
3373 prev="${COMP_WORDS[COMP_CWORD-1]}"
3375 if [[ $cur == -* ]]; then
3376 COMPREPLY=($(compgen -W "$opts" -- $cur))
3377 elif [[ $cur == * ]]; then
3378 COMPREPLY=($(compgen -W "$(_folders $cur)"))
3382 function _rmhlink () {
3389 cur="${COMP_WORDS[COMP_CWORD]}"
3390 prev="${COMP_WORDS[COMP_CWORD-1]}"
3392 if [[ $cur == -* ]]; then
3393 COMPREPLY=($(compgen -W "$opts" -- $cur))
3394 elif [[ $cur == * ]]; then
3395 COMPREPLY=($(compgen -W "$(_hltypes $cur)"))
3399 function _rmlabel () {
3409 cur="${COMP_WORDS[COMP_CWORD]}"
3410 prev="${COMP_WORDS[COMP_CWORD-1]}"
3412 if [[ $cur == -* ]]; then
3413 COMPREPLY=($(compgen -W "$opts" -- $cur))
3414 elif [[ $cur == * ]]; then
3415 COMPREPLY=($(compgen -W "$(_lbtypes $cur)"))
3419 function _rmproject () {
3428 cur="${COMP_WORDS[COMP_CWORD]}"
3429 prev="${COMP_WORDS[COMP_CWORD-1]}"
3431 if [[ $cur == -* ]]; then
3432 COMPREPLY=($(compgen -W "$opts" -- $cur))
3433 elif [[ $cur == * ]]; then
3434 COMPREPLY=($(compgen -W "$(_projects $cur)"))
3438 function _rmregion () {
3447 cur="${COMP_WORDS[COMP_CWORD]}"
3448 prev="${COMP_WORDS[COMP_CWORD-1]}"
3450 if [[ $cur == -* ]]; then
3451 COMPREPLY=($(compgen -W "$opts" -- $cur))
3452 elif [[ $prev == -tag ]]; then
3453 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
3457 function _rmstgloc () {
3466 cur="${COMP_WORDS[COMP_CWORD]}"
3467 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
3478 function _rmstream () {
3487 cur="${COMP_WORDS[COMP_CWORD]}"
3488 prev="${COMP_WORDS[COMP_CWORD-1]}"
3490 if [[ $cur == -* ]]; then
3491 COMPREPLY=($(compgen -W "$opts" -- $cur))
3492 elif [[ $cur == * ]]; then
3493 COMPREPLY=($(compgen -W "$(_streams $cur)"))
3497 function _rmtag () {
3508 cur="${COMP_WORDS[COMP_CWORD]}"
3509 prev="${COMP_WORDS[COMP_CWORD-1]}"
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))
3522 function _rmtrigger () {
3532 cur="${COMP_WORDS[COMP_CWORD]}"
3533 prev="${COMP_WORDS[COMP_CWORD-1]}"
3535 if [[ $cur == -* ]]; then
3536 COMPREPLY=($(compgen -W "$opts" -- $cur))
3537 elif [[ $cur == * ]]; then
3538 COMPREPLY=($(compgen -W "$(_trtypes $cur)"))
3542 function _rmtype () {
3552 cur="${COMP_WORDS[COMP_CWORD]}"
3553 prev="${COMP_WORDS[COMP_CWORD-1]}"
3555 if [[ $cur == -* ]]; then
3556 COMPREPLY=($(compgen -W "$opts" -- $cur))
3557 elif [[ $cur == * ]]; then
3562 function _rmview () {
3574 cur="${COMP_WORDS[COMP_CWORD]}"
3575 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
3586 function _rmvob () {
3593 cur="${COMP_WORDS[COMP_CWORD]}"
3594 prev="${COMP_WORDS[COMP_CWORD-1]}"
3596 if [[ $cur == -* ]]; then
3597 COMPREPLY=($(compgen -W "$opts" -- $cur))
3598 elif [[ $cur == * ]]; then
3599 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3603 function _setcs () {
3619 cur="${COMP_WORDS[COMP_CWORD]}"
3620 prev="${COMP_WORDS[COMP_CWORD-1]}"
3622 if [[ $cur == -* ]]; then
3623 COMPREPLY=($(compgen -W "$opts" -- $cur))
3624 elif [[ $cur == -tag ]]; then
3625 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3629 function _setplevel () {
3638 cur="${COMP_WORDS[COMP_CWORD]}"
3639 prev="${COMP_WORDS[COMP_CWORD-1]}"
3641 if [[ $cur == -* ]]; then
3642 COMPREPLY=($(compgen -W "$opts" -- $cur))
3643 elif [[ $prev == -invob ]]; then
3644 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3648 function _setview() {
3656 cur="${COMP_WORDS[COMP_CWORD]}"
3657 prev="${COMP_WORDS[COMP_CWORD-1]}"
3659 if [[ $cur == -* && $ARCHITECTURE != cygwin ]]; then
3660 COMPREPLY=($(compgen -W "$opts" -- $cur))
3661 elif [[ $cur == * ]]; then
3662 COMPREPLY=($(compgen -W "$(_views $cur)"))
3666 function _space () {
3681 cur="${COMP_WORDS[COMP_CWORD]}"
3682 prev="${COMP_WORDS[COMP_CWORD-1]}"
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)"))
3693 function _startview () {
3699 cur="${COMP_WORDS[COMP_CWORD]}"
3700 prev="${COMP_WORDS[COMP_CWORD-1]}"
3702 if [[ $cur == -* ]]; then
3703 COMPREPLY=($(compgen -W "$opts" -- $cur))
3704 elif [[ $cur == * ]]; then
3705 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3709 function _umount () {
3716 cur="${COMP_WORDS[COMP_CWORD]}"
3717 prev="${COMP_WORDS[COMP_CWORD-1]}"
3719 if [[ $cur == -* ]]; then
3720 COMPREPLY=($(compgen -W "$opts" -- $cur))
3721 elif [[ $cur == * ]]; then
3722 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3726 function _unlock () {
3735 cur="${COMP_WORDS[COMP_CWORD]}"
3736 prev="${COMP_WORDS[COMP_CWORD-1]}"
3738 if [[ $cur == -* ]]; then
3739 COMPREPLY=($(compgen -W "$opts" -- $cur))
3740 elif [[ $cur == * ]]; then
3741 COMPREPLY=($(compgen -W "$(_object_selector $cur)" -- $cur))
3749 cur="${COMP_WORDS[COMP_CWORD]}"
3750 cmd="${COMP_WORDS[0]}"
3751 subcmd="${COMP_WORDS[1]}"
3753 if [[ $cmd == scm || $cmd == ct ]]; then
3754 if [[ $COMP_CWORD == 1 ]]; then
3755 COMPREPLY=($(compgen -W "$_scm_cmds" -- $cur))
3759 COMPREPLY=($(compgen -W "$_annotate_opts" -- $cur));;
3761 COMPREPLY=($(compgen -W "$_catcr_opts" -- $cur));;
3767 COMPREPLY=($(compgen -W "$_chbl_opts" -- $cur));;
3771 COMPREPLY=($(compgen -W "$_checkout_opts" -- $cur));;
3777 COMPREPLY=($(compgen -W "$_chflevel_opts" -- $cur));;
3783 COMPREPLY=($(compgen -W "$_chpool_opts" -- $cur));;
3789 COMPREPLY=($(compgen -W "$_chtype_opts" -- $cur));;
3797 COMPREPLY=($(compgen -W "$_diff_opts" -- $cur));;
3799 COMPREPLY=($(compgen -W "$_diffbl_opts" -- $cur));;
3801 COMPREPLY=($(compgen -W "$_diffcr_opts" -- $cur));;
3811 COMPREPLY=($(compgen -W "$_find_opts" -- $cur));;
3813 COMPREPLY=($(compgen -W "$_findmerge_opts" -- $cur));;
3815 COMPREPLY=($(compgen -W "$_get_opts" -- $cur));;
3817 COMPREPLY=($(compgen -W "$_getcache_opts" -- $cur));;
3821 COMPREPLY=($(compgen -W "$_scm_cmds" -- $cur));;
3825 COMPREPLY=($(compgen -W "$_ln_opts" -- $cur));;
3827 COMPREPLY=($(compgen -W "$_ls_opts" -- $cur));;
3833 COMPREPLY=($(compgen -W "$_lscheckout_opts" -- $cur));;
3839 COMPREPLY=($(compgen -W "$_lsdo_opts" -- $cur));;
3843 COMPREPLY=($(compgen -W "$_lshistory_opts" -- $cur));;
3845 COMPREPLY=($(compgen -W "$_lslock_opts" -- $cur));;
3847 COMPREPLY=($(compgen -W "$_lsmaster_opts" -- $cur));;
3857 COMPREPLY=($(compgen -W "$_lsreplica_opts" -- $cur));;
3859 COMPREPLY=($(compgen -W "$_lssite_opts" -- $cur));;
3871 COMPREPLY=($(compgen -W "$_lsvtree_opts" -- $cur));;
3873 COMPREPLY=($(compgen -W "$_scm_cmds" -- $cur));;
3875 COMPREPLY=($(compgen -W "$_merge_opts" -- $cur));;
3879 COMPREPLY=($(compgen -W "$_mkattr_opts" -- $cur));;
3881 COMPREPLY=($(compgen -W "$_mkattype_opts" -- $cur));;
3885 COMPREPLY=($(compgen -W "$_mkbranch_opts" -- $cur));;
3887 COMPREPLY=($(compgen -W "$_mkbrtype_opts" -- $cur));;
3891 COMPREPLY=($(compgen -W "$_mkdir_opts" -- $cur));;
3893 COMPREPLY=($(compgen -W "$_mkelem_opts" -- $cur));;
3895 COMPREPLY=($(compgen -W "$_mkeltype_opts" -- $cur));;
3899 COMPREPLY=($(compgen -W "$_mkhlink_opts" -- $cur));;
3901 COMPREPLY=($(compgen -W "$_mkhltype_opts" -- $cur));;
3903 COMPREPLY=($(compgen -W "$_mklabel_opts" -- $cur));;
3905 COMPREPLY=($(compgen -W "$_mklbtype_opts" -- $cur));;
3907 COMPREPLY=($(compgen -W "$_mkpool_opts" -- $cur));;
3919 COMPREPLY=($(compgen -W "$_mktrigger_opts" -- $cur));;
3929 COMPREPLY=($(compgen -W "$_move_opts" -- $cur));;
3931 COMPREPLY=($(compgen -W "$_protect_opts" -- $cur));;
3933 COMPREPLY=($(compgen -W "$_protectvob_opts" -- $cur));;
3935 COMPREPLY=($(compgen -W "$_pwd_opts" -- $cur));;
3937 COMPREPLY=($(compgen -W "$_pwv_opts" -- $cur));;
3949 COMPREPLY=($(compgen -W "$_relocate_opts" -- $cur));;
3951 COMPREPLY=($(compgen -W "$_rename_opts" -- $cur));;
3953 COMPREPLY=($(compgen -W "$_reqmaster_opts" -- $cur));;
3955 COMPREPLY=($(compgen -W "$_reserve_opts" -- $cur));;
3963 COMPREPLY=($(compgen -W "$_rmbranch_opts" -- $cur));;
3967 COMPREPLY=($(compgen -W "$_rmdo_opts" -- $cur));;
3969 COMPREPLY=($(compgen -W "$_rmelem_opts" -- $cur));;
3977 COMPREPLY=($(compgen -W "$_rmmerge_opts" -- $cur));;
3979 COMPREPLY=($(compgen -W "$_rmname_opts" -- $cur));;
3981 COMPREPLY=($(compgen -W "$_rmpool_opts" -- $cur));;
3997 COMPREPLY=($(compgen -W "$_rmver_opts" -- $cur));;
4003 COMPREPLY=($(compgen -W "$_schedule_opts" -- $cur));;
4005 COMPREPLY=($(compgen -W "$_setcache_opts" -- $cur));;
4013 COMPREPLY=($(compgen -W "$_setsite_opts" -- $cur));;
4021 COMPREPLY=($(compgen -W "$_uncheckout_opts" -- $cur));;
4025 COMPREPLY=($(compgen -W "$_unregister_opts" -- $cur));;
4027 COMPREPLY=($(compgen -W "$_unreserve_opts" -- $cur));;
4029 COMPREPLY=($(compgen -W "$_update_opts" -- $cur));;
4031 COMPREPLY=($(compgen -W "$_winkin_opts" -- $cur));;
4037 # TODO: These functions aren't working very well yet.
4038 function _type_selector () {
4039 local cur prev prev2
4041 cur="${COMP_WORDS[COMP_CWORD]}"
4043 if (($COMP_CWORD - 1 >= 0)); then
4044 prev="${COMP_WORDS[COMP_CWORD-1]}"
4047 if (($COMP_CWORD - 2 >= 0)); then
4048 prev2="${COMP_WORDS[COMP_CWORD-2]}"
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))
4060 function _object_selector () {
4061 local cur prev prev2
4065 cur="${COMP_WORDS[COMP_CWORD]}"
4067 if (($COMP_CWORD - 1 >= 0)); then
4068 prev="${COMP_WORDS[COMP_CWORD-1]}"
4071 if (($COMP_CWORD - 2 >= 0)); then
4072 prev2="${COMP_WORDS[COMP_CWORD-2]}"
4075 if [[ $prev == activity || ($prev == : && $prev2 == activity) ]]; then
4076 if [[ $cur == : ]]; then
4077 COMPREPLY=($(compgen -W "$(_activities)" -- ""))
4080 COMPREPLY=($(compgen -W "$(_activities $cur)"))
4081 echo "COMPREPLY = ${COMPREPLY[*]}"
4083 elif [[ $prev == lbtype || ($prev == : && $prev2 == lbtype) ]]; then
4084 if [[ $cur == : ]]; then
4085 COMPREPLY=($(compgen -W "$(_lbtypes)" -- ""))
4086 echo "COMPREPLY = ${COMPREPLY[*]}"
4089 COMPREPLY=($(compgen -W "$(_lbtypes $cur)"))
4090 echo "COMPREPLY = ${COMPREPLY[*]}"
4092 elif [[ $cur == * ]] ; then
4093 COMPREPLY=($(compgen -W "$_object_selectors" -- $cur))
4095 } # _object_selector
4097 complete -o default -F _scm scm ct
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
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