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-2016, ClearSCM, Inc., all rights reserved.
16 ################################################################################
17 if [ $ARCHITECTURE = 'cygwin' ]; then
18 export CCHOME=$(cygpath -u "$(regtool get '/machine/SOFTWARE/Rational Software/RSINSTALLDIR' 2>/dev/null)"/Clearcase 2>/dev/null);
20 export CCHOME="/opt/rational/clearcase"
23 if [ ! -d "$CCHOME" ]; then
28 # Source in clearcase.conf
29 if [ -f ~/.rc/clearcase.conf ]; then
30 source ~/.rc/clearcase.conf
32 echo "WARNING: Could not find ~/.rc/clearcase.conf - functionality will be limted"
35 export CLEARTOOL="$CCHOME/bin/cleartool"
36 export CLEARCASE_BLD_HOST_TYPE="unix"
38 if [ -f "$CCHOME/etc/utils/creds" ]; then
39 if [ $ARCHITECTURE = 'cygwin' ]; then
40 alias creds=$(cygpath "$CCHOME/etc/utils/creds")
42 alias creds="$CCHOME/etc/utils/creds"
46 if [ -x "$CLEARTOOL" ]; then
47 export RGY="$CCHOME/var/atria/rgy"
48 export LOGS="$CCHOME/var/log"
54 if [ -x "$CLEARTOOL" ]; then
55 # Cleartool suddenly started appending ^M's (I think as of 7.1)
56 if [ $ARCHITECTURE = 'cygwin' ]; then
57 # Need to set pipefail to pick up the exit code from cleartool
58 # otherwise we get the exit code from tr which is usually 0
60 "$CLEARTOOL" "$@" | tr -d "\015"
75 # Setview is special - there is no setview on Windows. But we approximate it
76 # with the function setview
77 if [ "$1" = "setview" ]; then
88 if [ "$(scm pwv)" != '' ]; then
90 elif [ -f CVS/Root ]; then
99 echo "ci: Error: No files specified"
107 echo "co: Error: No files specified"
115 echo "unco: Error: No files specified"
126 scm lslock -long "$@"
129 # View related functions
131 if [ $ARCHITECTURE = 'cygwin' ]; then
132 if [[ $1 = -* ]]; then
133 echo "The setview command with options is not supported on Windows"
137 # Save off where we are
147 # Setup $VOBTAG_PREFIX
148 mount -f -o binary M:/$1 $LINUX_VOBTAG_PREFIX
153 # Remove $LINUX_VOBTAG_PREFIX mount (Ignore errors)
154 umount $LINUX_VOBTAG_PREFIX 2> /dev/null
156 # Chdir back to were we started
177 scm endview -server "$@"
186 echo "Usage: $FUNCNAME <stream>"
192 # Check to see if the view already exists
193 scm lsview -short ${USER}_$stream > /dev/null 2>&1
196 echo "${USER}_$stream already exists!"
198 mkview -tag ${USER}_$stream -stream $stream@$pvob -stgloc -auto
201 echo "Couldn't find that stream. Perhaps it's one of these?"
203 searchFor=${stream:1:$i}
204 scm lsstream -short -invob $pvob | grep $searchFor | $PAGER
209 setview ${USER}_$stream
218 scm lsview -s | $PAGER
219 elif [ $# = 1 ]; then
220 scm lsview -s | grep "$1"
227 # Well they asked for my "views"...
228 if [ $(whence fortune) ]; then
233 # List my views and their associated activities
234 for view in $(scm lsview -s 2>&1 | grep $USER); do
235 headline=$(scm lsact -cact -fmt "%[headline]p" -view $view 2> /dev/null)
237 if [ "$headline" = "" ]; then
238 headline="<no activity set>"
241 echo -e "$view\t$headline"
247 scm lsview -long | $PAGER
249 scm lsview -long "$@"
257 scm lsview -short | grep $1
261 # Vob related functions
265 elif [ $# = 1 ]; then
266 scm lsvob | grep "$1"
274 scm lsvob -long | $PAGER
284 scm lsvob -short | grep $1
288 # Config spec functions
325 elif [ $# == 1 ]; then
329 echo "Usage: oid2name: <oid> [<pvob>]"
334 scm describe oid:$oid@$projvob 2> /dev/null | head -1
342 elif [ $# == 2 ]; then
347 echo "Usage: name2oid: <type> <name> [<pvob>]"
352 scm dump $type:$name@$projvob 2> /dev/null | grep oid=
358 echo "vtree: Error: Must specify an element to view its version tree"
360 if [ $ARCHITECTURE = 'cygwin' ]; then
377 scmsystem; scmtype=$?
380 if [ $scmtype = 1 ]; then
381 scm diff -graphical -pred $1
382 elif [ $scmtype = 2 ]; then
386 if [ $scmtype = 1 ]; then
387 scm diff -graphical "$@"
388 elif [ $scmtype = 2 ]; then
396 scm xdiff -vstack -pred $1
402 # Administrative functions
411 function unregister {
415 # Information functions
424 scm lstype trtype:$trig_name@$vob
426 scm lstype -kind trtype "$@" | $PAGER
432 scm lstype -long trtype:$1
434 scm lstype -long -kind trtype "$@"| $PAGER
446 # UCM oriented functions
449 # If we are in a view context then try to list the stream for our view
450 if [[ $(pwv) == "** NONE **" ]]; then
453 scm lsstream | $PAGER
456 # Check to see if a pvob was specified
457 if [[ $@ == *@* ]]; then
460 scm lsstream -invob $pvob | grep $1 | $PAGER
467 scm lsstream -l | $PAGER
475 scm lsstream -short -invob $pvob
477 scm lsstream -short "$@"
481 function lsregions () {
482 if [ $# -gt 0 ]; then
483 scm lsregion -short | grep ^$1
507 scm lsproject | $PAGER
515 scm lsproject -l | $PAGER
517 scm lsproject -l "$@"
526 scm lsfolder -long "$@"
531 scm lsstgloc | $PAGER
539 scm lsstgloc -l | $PAGER
547 scm lsactivity | $PAGER
555 scm lsactivity -l | $PAGER
557 scm lsactivity -l "$@"
563 echo "What? Am I suppose to guess?!?"
571 scmsystem; scmtype=$?
573 if [ $scmtype = 1 ]; then
574 scm lsco -short -cview -all -me
575 elif [ $scmtype = 2 ]; then
576 cvs -Q status | grep ^File | grep -v Up-to-date
584 # Bash completion for Clearcase commands. T
586 # Add "," to COMP_BREAKWORDS
587 COMP_WORDBREAKS=\ \"\'\>\<\=\;\|\&\(\:\,
589 # All Clearcase commands
756 # These options are common to all scm commands. So far -help is the only one
760 # Comment opts. These options are common for commands that request the user
769 # Individual command options
1486 _setactivity_opts="\
1576 _object_selectors="\
1653 if [ $ARCHITECTURE = 'cygwin' ]; then
1655 POLICY_WIN_INT_SNAP \
1656 POLICY_WIN_DEV_SNAP \
1660 POLICY_UNIX_INT_SNAP \
1661 POLICY_UNIX_DEV_SNAP \
1667 POLICY_CHPROJECT_UNRESTRICED \
1668 POLICY_DELIVER_REQUIRE_REBASE \
1669 POLICY_DELIVER_NCO_DEVSTR \
1670 POLICY_DELIVER_NOCO_SELACTS \
1672 POLICY_INTRAPROJECT_DELIVER_FOUNDATION_CHANGES \
1673 POLICY_INTRAPROJECT_DELIVER_ALLOW_MISSING_TGTCOMPS \
1674 POLICY_INTERPROJECT_DELIVER \
1675 POLICY_INTERPROJECT_DELIVER_FOUNDATION_CHANGES \
1676 POLICY_INTERPROJECT_DELIVER_REQUIRE_TGTCOMP_VISIBIITY \
1677 POLICY_INTERPROJECT_DELIVER_ALLOW_NONMOD_TGTCOMPS \
1681 function set_pvob () {
1682 if [ $# -eq 1 ]; then
1687 function set_dvob () {
1688 if [ $# -eq 1 ]; then
1693 # Listing type functions. These functions produce a list of some object and are
1694 # used by the various completion functions.
1695 function _attypes () {
1696 if [ $# -gt 0 ]; then
1697 scm lstype -kind attype -invob $pvob -fmt "%n " | grep ^$1
1699 scm lstype -kind attype -invob $pvob -fmt "%n "
1703 function _activities () {
1704 if [ $# -gt 0 ]; then
1705 scm lsactivity -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1707 scm lsactivity -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1711 function _baselines () {
1712 stream=$(scm lsstream -short 2> /dev/null)
1714 if [ -z $stream ]; then
1718 if [ $# -ge 0 ]; then
1719 scm lsbl -stream $stream@$pvob -short | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1721 scm lsbl -stream $stream@$pvob -short | sed "s:$:@$vobtagPrefix$pvob:"
1725 function _brtypes () {
1726 if [ $# -gt 0 ]; then
1727 scm lstype -kind brtype -invob $pvob -fmt "%n\n" | grep ^$1
1729 scm lstype -kind brtype -invob $pvob -fmt "%n\n"
1733 function _cchosts () {
1734 registryHost=$(scm hostinfo -long | grep "Registry host:" | awk '{print $NF}')
1736 scm lsclients -short -host $registryHost | tr [:upper:] [:lower:]
1739 function _components () {
1740 if [ $# -gt 0 ]; then
1741 scm lscomp -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1743 scm lscomp -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1747 function _eltypes () {
1748 if [ $# -gt 0 ]; then
1749 scm lstype -kind eltype -invob $pvob -fmt "%n " | grep ^$1
1751 scm lstype -kind eltype -invob $pvob -fmt "%n "
1755 function _folders () {
1756 if [ $# -gt 0 ]; then
1757 scm lsfolder -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1759 scm lsfolder -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1763 function _hltypes () {
1764 if [ $# -gt 0 ]; then
1765 scm lstype -kind hltype -invob $pvob -fmt "%n " | grep ^$1
1767 scm lstype -kind hltype -invob $pvob -fmt "%n "
1771 function _lbtypes () {
1772 if [ $# -gt 0 ]; then
1773 scm lstype -kind lbtype -invob $pvob -fmt "%n@$vobtagPrefix$pvob " | grep ^$1
1775 scm lstype -kind lbtype -invob $pvob -fmt "%n@$vobtagPrefix$pvob "
1779 function _projects () {
1780 if [ $# -gt 0 ]; then
1781 scm lsproject -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1783 scm lsproject -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1787 function _streams () {
1788 if [ $# -gt 0 ]; then
1789 scm lsstream -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1791 scm lsstream -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1795 function _stglocs () {
1796 if [ $# -gt 0 ]; then
1797 scm lsstgloc -short | grep ^$1
1803 function _views () {
1804 if [ $# -gt 0 ]; then
1805 scm lsview -short | grep ^$1;
1812 # We simply must rid ourselves of these bloody backlashes!!! And yet Clearcase
1813 # insists on retaining them. Let's strip them off, do our thing, then put them
1814 # back to backslashes when we output stuff.
1815 if [ $ARCHITECTURE = 'cygwin' ]; then
1816 if [ $# -eq 0 ]; then
1817 scm lsvob -short | sed 's:\\:\\\\\\\\:'
1819 # Convert to foward slashes
1820 vob=$(echo $1 | sed 's:\\::g')
1822 scm lsvob -short | sed 's:\\::' | grep ^$vob | sed 's:^:\\\\\\\\:'
1825 if [ $# -eq 0 ]; then
1828 scm lsvob -short | grep ^$1
1833 function _trtypes () {
1834 if [ $# -gt 0 ]; then
1835 scm lstype -kind trtype -invob $pvob -fmt "%n " | grep ^$1
1837 scm lstype -kind trtype -invob $pvob -fmt "%n "
1841 # Completion functions for individual commands where the completion may change
1842 # depending on the operation. For example, typing "scm catcs -tag " should
1843 # now complete based on view tags whereas "scm catcs -" should just complete
1844 # based on options (which are only -help and -tag at this point for this
1845 # particular command). If a command does not have a "completer function" then
1846 # it will only provide for options completion and will be handled by the general
1847 # _scm completion function.
1848 function _catcs () {
1855 cur="${COMP_WORDS[COMP_CWORD]}"
1856 prev="${COMP_WORDS[COMP_CWORD-1]}"
1858 if [[ $cur == -* ]]; then
1859 COMPREPLY=($(compgen -W "$opts" -- $cur))
1860 elif [[ $prev == -tag ]]; then
1861 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
1865 function _chactivity () {
1878 cur="${COMP_WORDS[COMP_CWORD]}"
1879 prev="${COMP_WORDS[COMP_CWORD-1]}"
1881 if [[ $cur == -* ]]; then
1882 COMPREPLY=($(compgen -W "$opts" -- $cur))
1883 elif [[ $prev == -fcset || $prev == -tcset ]]; then
1884 COMPREPLY=($(compgen -W "$(_activities $cur)"))
1885 elif [[ $prev == -view ]]; then
1886 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
1890 function _checkin () {
1891 local cur prev prev2
1904 cur="${COMP_WORDS[COMP_CWORD]}"
1905 prev="${COMP_WORDS[COMP_CWORD-1]}"
1906 prev2="${COMP_WORDS[COMP_CWORD-2]}"
1908 if [[ $cur == -* ]]; then
1909 COMPREPLY=($(compgen -W "$opts" -- $cur))
1910 elif [[ $prev2 == activity && $prev == : ]]; then
1911 COMPREPLY=($(compgen -W "$(_activities $cur)"))
1915 function _checkvob () {
1950 cur="${COMP_WORDS[COMP_CWORD]}"
1951 prev="${COMP_WORDS[COMP_CWORD-1]}"
1953 if [[ $cur == -* ]]; then
1954 COMPREPLY=($(compgen -W "$opts" -- $cur))
1955 elif [[ $prev == -view ]]; then
1956 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
1960 function _chevent () {
1973 cur="${COMP_WORDS[COMP_CWORD]}"
1974 prev="${COMP_WORDS[COMP_CWORD-1]}"
1976 if [[ $cur == -* ]]; then
1977 COMPREPLY=($(compgen -W "$opts" -- $cur))
1978 elif [[ $prev == -invob ]]; then
1979 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
1980 elif [[ $cur == * ]]; then
1981 COMPREPLY=($(compgen -W "$_object_selectors" -- $cur))
1985 function _chfolder () {
1993 cur="${COMP_WORDS[COMP_CWORD]}"
1994 prev="${COMP_WORDS[COMP_CWORD-1]}"
1996 if [[ $cur == -* ]]; then
1997 COMPREPLY=($(compgen -W "$opts" -- $cur))
1998 elif [[ $prev == -to ]]; then
1999 COMPREPLY=($(compgen -W "$(_folders $cur)"))
2000 elif [[ $cur == * ]]; then
2001 COMPREPLY=($(compgen -W "$(_folders $cur)"))
2005 function _chmaster () {
2020 cur="${COMP_WORDS[COMP_CWORD]}"
2021 prev="${COMP_WORDS[COMP_CWORD-1]}"
2023 if [[ $cur == -* ]]; then
2024 COMPREPLY=($(compgen -W "$opts" -- $cur))
2025 elif [[ $prev == -stream ]]; then
2026 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2027 elif [[ $cur == -view ]]; then
2028 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2032 function _chproject () {
2052 cur="${COMP_WORDS[COMP_CWORD]}"
2053 prev="${COMP_WORDS[COMP_CWORD-1]}"
2055 if [[ $cur == -* ]]; then
2056 COMPREPLY=($(compgen -W "$opts" -- $cur))
2057 elif [[ $prev == -amodcomp ||
2058 $prev == -dmodcomp ]]; then
2059 COMPREPLY=($(compgen -W "$(_components $cur)"))
2060 elif [[ $prev == -to ]]; then
2061 COMPREPLY=($(compgen -W "$(_folders $cur)"))
2062 elif [[ $prev == -policy ||
2063 $prev == -npolicy ||
2064 $prev == -spolicy ]]; then
2065 COMPREPLY=($(compgen -W "$_policies" -- $cur))
2066 elif [[ $cur == * ]]; then
2067 COMPREPLY=($(compgen -W "$(_projects $cur)"))
2071 function _chstream () {
2090 cur="${COMP_WORDS[COMP_CWORD]}"
2091 prev="${COMP_WORDS[COMP_CWORD-1]}"
2093 if [[ $cur == -* ]]; then
2094 COMPREPLY=($(compgen -W "$opts" -- $cur))
2095 elif [[ $prev == -amodcomp ||
2096 $prev == -dmodcomp ]]; then
2097 COMPREPLY=($(compgen -W "$(_components $cur)"))
2098 elif [[ $prev == -policy ||
2099 $prev == -npolicy ]]; then
2100 COMPREPLY=($(compgen -W "$_policies" -- $cur))
2101 elif [[ $prev == , || $prev == -recommended || $cur == , ]]; then
2102 if [[ $cur == , ]]; then
2105 COMPREPLY=($(compgen -W "$(_baselines $cur)"))
2106 elif [[ $prev == -target || $cur == * ]]; then
2107 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2111 function _chview () {
2125 cur="${COMP_WORDS[COMP_CWORD]}"
2126 prev="${COMP_WORDS[COMP_CWORD-1]}"
2128 if [[ $cur == -* ]]; then
2129 COMPREPLY=($(compgen -W "$opts" -- $cur))
2130 elif [[ $prev == -stream ]]; then
2131 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2132 elif [[ $prev == * ]]; then
2133 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2137 function _deliver () {
2155 cur="${COMP_WORDS[COMP_CWORD]}"
2156 prev="${COMP_WORDS[COMP_CWORD-1]}"
2158 if [[ $cur == -* ]]; then
2159 COMPREPLY=($(compgen -W "$opts" -- $cur))
2160 elif [[ $prev == -stream || $prev == -target ]]; then
2161 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2162 elif [[ $prev == -to ]]; then
2163 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2164 elif [[ $prev == -activities ]]; then
2165 COMPREPLY=($(compgen -W "$(_activities $cur)"))
2169 function _describe () {
2190 cur="${COMP_WORDS[COMP_CWORD]}"
2191 prev="${COMP_WORDS[COMP_CWORD-1]}"
2193 if [[ $cur == -* ]]; then
2194 COMPREPLY=($(compgen -W "$opts" -- $cur))
2195 elif [[ $cur == * ]]; then
2196 COMPREPLY=($(compgen -W "$_object_selectors" -- $cur))
2200 function _dospace () {
2215 cur="${COMP_WORDS[COMP_CWORD]}"
2216 prev="${COMP_WORDS[COMP_CWORD-1]}"
2218 if [[ $cur == -* ]]; then
2219 COMPREPLY=($(compgen -W "$opts" -- $cur))
2220 elif [[ $prev == -region ]]; then
2221 COMPREPLY=($(compgen -W "$(lsregions)" -- $cur))
2236 cur="${COMP_WORDS[COMP_CWORD]}"
2237 prev="${COMP_WORDS[COMP_CWORD-1]}"
2239 if [[ $cur == -* ]]; then
2240 COMPREPLY=($(compgen -W "$opts" -- $cur))
2241 elif [[ $prev == -tag ]]; then
2242 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2246 function _endview () {
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 == * ]]; then
2259 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2271 cur="${COMP_WORDS[COMP_CWORD]}"
2272 prev="${COMP_WORDS[COMP_CWORD-1]}"
2274 if [[ $cur == -* ]]; then
2275 COMPREPLY=($(compgen -W "$opts" -- $cur))
2276 elif [[ $prev == -invob ]]; then
2277 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2281 function _getlog () {
2298 cur="${COMP_WORDS[COMP_CWORD]}"
2299 prev="${COMP_WORDS[COMP_CWORD-1]}"
2301 if [[ $cur == -* ]]; then
2302 COMPREPLY=($(compgen -W "$opts" -- $cur))
2303 elif [[ $prev == -tag || $prev == -target ]]; then
2304 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2305 elif [[ $prev == -vob ]]; then
2306 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2307 elif [[ $prev == -host ]]; then
2308 COMPREPLY=($(compgen -W "$(_cchosts)" -- $cur))
2312 function _hostinfo () {
2321 cur="${COMP_WORDS[COMP_CWORD]}"
2322 prev="${COMP_WORDS[COMP_CWORD-1]}"
2324 if [[ $cur == -* ]]; then
2325 COMPREPLY=($(compgen -W "$opts" -- $cur))
2326 elif [[ $cur == * ]]; then
2327 COMPREPLY=($(compgen -W "$(_cchosts)" -- $cur))
2331 function _lsactivity () {
2353 cur="${COMP_WORDS[COMP_CWORD]}"
2354 prev="${COMP_WORDS[COMP_CWORD-1]}"
2356 if [[ $cur == -* ]]; then
2357 COMPREPLY=($(compgen -W "$opts" -- $cur))
2358 elif [[ $prev == -invob ]]; then
2359 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2360 elif [[ $prev == -in ]]; then
2361 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2362 elif [[ $prev == -view ]]; then
2363 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2364 elif [[ $cur == * ]]; then
2365 COMPREPLY=($(compgen -W "$(_activities $cur)"))
2388 cur="${COMP_WORDS[COMP_CWORD]}"
2389 prev="${COMP_WORDS[COMP_CWORD-1]}"
2391 if [[ $cur == -* ]]; then
2392 COMPREPLY=($(compgen -W "$opts" -- $cur))
2393 elif [[ $prev == -component ]]; then
2394 COMPREPLY=($(compgen -W "$(_components $cur)"))
2395 elif [[ $prev == -stream ]]; then
2396 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2400 function _lsclients () {
2410 cur="${COMP_WORDS[COMP_CWORD]}"
2411 prev="${COMP_WORDS[COMP_CWORD-1]}"
2413 if [[ $cur == -* ]]; then
2414 COMPREPLY=($(compgen -W "$opts" -- $cur))
2415 elif [[ $prev == -host ]]; then
2416 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
2420 function _lscomp () {
2432 cur="${COMP_WORDS[COMP_CWORD]}"
2433 prev="${COMP_WORDS[COMP_CWORD-1]}"
2435 if [[ $cur == -* ]]; then
2436 COMPREPLY=($(compgen -W "$opts" -- $cur))
2437 elif [[ $prev == -invob ]]; then
2438 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2439 elif [[ $cur == * ]]; then
2440 COMPREPLY=($(compgen -W "$(_components $cur)"))
2444 function _lsfolder () {
2460 local lopts="$opts -long"
2462 cur="${COMP_WORDS[COMP_CWORD]}"
2463 prev="${COMP_WORDS[COMP_CWORD-1]}"
2465 if [[ $cur == -* ]]; then
2466 if [[ $prev == -llfolder ]]; then
2467 COMPREPLY=($(compgen -W "$opts" -- $cur))
2469 COMPREPLY=($(compgen -W "$lopts" -- $cur))
2471 elif [[ $prev == -invob ]]; then
2472 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2473 elif [[ $prev == -view ]]; then
2474 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2475 elif [[ $prev == -in || $cur == * ]]; then
2476 COMPREPLY=($(compgen -W "$(_folders $cur)"))
2480 function _lspool () {
2491 cur="${COMP_WORDS[COMP_CWORD]}"
2492 prev="${COMP_WORDS[COMP_CWORD-1]}"
2494 if [[ $cur == -* ]]; then
2495 COMPREPLY=($(compgen -W "$opts" -- $cur))
2496 elif [[ $prev == -invob ]]; then
2497 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2501 function _lsprivate () {
2516 cur="${COMP_WORDS[COMP_CWORD]}"
2517 prev="${COMP_WORDS[COMP_CWORD-1]}"
2519 if [[ $cur == -* ]]; then
2520 COMPREPLY=($(compgen -W "$opts" -- $cur))
2521 elif [[ $prev == -tag ]]; then
2522 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2523 elif [[ $prev == -invob ]]; then
2524 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2528 function _lsproject () {
2548 cur="${COMP_WORDS[COMP_CWORD]}"
2549 prev="${COMP_WORDS[COMP_CWORD-1]}"
2551 if [[ $cur == -* ]]; then
2552 COMPREPLY=($(compgen -W "$opts" -- $cur))
2553 elif [[ $prev == -view ]]; then
2554 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2555 elif [[ $prev == -invob ]]; then
2556 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2557 elif [[ $prev == -in || $cur == * ]]; then
2558 COMPREPLY=($(compgen -W "$(_folders $cur)"))
2562 function _lsregion () {
2570 cur="${COMP_WORDS[COMP_CWORD]}"
2571 prev="${COMP_WORDS[COMP_CWORD-1]}"
2573 if [[ $cur == -* ]]; then
2574 COMPREPLY=($(compgen -W "$opts" -- $cur))
2575 elif [[ $prev == * ]]; then
2576 regions=$(scm lsregion -short | grep ^$cur)
2577 COMPREPLY=($(compgen -W "$regions" -- $cur))
2581 function _lsstgloc () {
2594 cur="${COMP_WORDS[COMP_CWORD]}"
2595 prev="${COMP_WORDS[COMP_CWORD-1]}"
2597 if [[ $cur == -* ]]; then
2598 COMPREPLY=($(compgen -W "$opts" -- $cur))
2599 elif [[ $prev == -region ]]; then
2600 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
2601 elif [[ $prev == -storage ]]; then
2602 COMPREPLY=($(compgen -W "$(_stglocs $cur)"))
2603 elif [[ $prev == -host ]]; then
2608 function _lsstream () {
2625 local lopts="$opts -long"
2627 cur="${COMP_WORDS[COMP_CWORD]}"
2628 prev="${COMP_WORDS[COMP_CWORD-1]}"
2630 if [[ $cur == -* ]]; then
2631 if [[ $prev == llstream ]]; then
2632 COMPREPLY=($(compgen -W "$opts" -- $cur))
2634 COMPREPLY=($(compgen -W "$lopts" -- $cur))
2636 elif [[ $prev == -in ]]; then
2637 COMPREPLY=($(compgen -W "$(_projects $cur)"))
2638 elif [[ $prev == -invob ]]; then
2639 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2640 elif [[ $prev == -view ]]; then
2641 COMPREPLY=($(compgen -W "$(lsviews)"))
2642 elif [[ $cur == * ]]; then
2643 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2647 function _lstype () {
2663 cur="${COMP_WORDS[COMP_CWORD]}"
2664 prev="${COMP_WORDS[COMP_CWORD-1]}"
2666 if [[ $cur == -* ]]; then
2667 COMPREPLY=($(compgen -W "$opts" -- $cur))
2668 elif [[ $prev == -kind ]]; then
2669 COMPREPLY=($(compgen -W "$_kinds" -- $cur))
2670 elif [[ $prev == -invob ]]; then
2671 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2672 elif [[ $cur == * ]]; then
2677 function _lsview () {
2693 local lopts="$opts -long"
2696 cur="${COMP_WORDS[COMP_CWORD]}"
2697 prev="${COMP_WORDS[COMP_CWORD-1]}"
2699 if [[ $cur == -* ]]; then
2700 if [[ $prev == llview ]]; then
2701 COMPREPLY=($(compgen -W "$opts" -- $cur))
2703 COMPREPLY=($(compgen -W "$lopts" -- $cur))
2705 elif [[ $prev == -region ]]; then
2706 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
2707 elif [[ $prev == -host ]]; then
2708 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
2709 elif [[ $cur == * ]]; then
2710 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2714 function _lsvob () {
2729 cur="${COMP_WORDS[COMP_CWORD]}"
2730 prev="${COMP_WORDS[COMP_CWORD-1]}"
2732 if [[ $cur == -* ]]; then
2733 if [[ $prev == llvob ]]; then
2734 COMPREPLY=($(compgen -W "$opts" -- $cur))
2736 COMPREPLY=($(compgen -W "$lopts" -- $cur))
2738 elif [[ $prev == -region ]]; then
2739 COMPREPLY=($(compgen -W "$(_regions $cur)"))
2740 elif [[ $prev == -host ]]; then
2741 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
2742 elif [[ $cur == * ]]; then
2743 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2747 function _mkactivity () {
2757 cur="${COMP_WORDS[COMP_CWORD]}"
2758 prev="${COMP_WORDS[COMP_CWORD-1]}"
2760 if [[ $cur == -* ]]; then
2761 COMPREPLY=($(compgen -W "$opts" -- $cur))
2762 elif [[ $prev == -in ]]; then
2763 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2785 cur="${COMP_WORDS[COMP_CWORD]}"
2786 prev="${COMP_WORDS[COMP_CWORD-1]}"
2788 if [[ $cur == -* ]]; then
2789 COMPREPLY=($(compgen -W "$opts" -- $cur))
2790 elif [[ $prev == -activities ]]; then
2791 COMPREPLY=($(compgen -W "$(_activities $cur)"))
2792 elif [[ $prev == -component ||
2793 $prev == -adepends_on ||
2794 $prev == -ddepends_on ]]; then
2795 COMPREPLY=($(compgen -W "$(_components $cur)"))
2796 elif [[ $prev == -clone ]]; then
2797 COMPREPLY=($(compgen -W "$(_baselines $cur)"))
2798 elif [[ $prev == -view ]]; then
2799 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2803 function _mkcomp () {
2811 cur="${COMP_WORDS[COMP_CWORD]}"
2812 prev="${COMP_WORDS[COMP_CWORD-1]}"
2814 if [[ $cur == -* ]]; then
2815 COMPREPLY=($(compgen -W "$opts" -- $cur))
2816 elif [[ $cur == * ]]; then
2817 COMPREPLY=($(compgen -W "$(_components $cur)"))
2821 function _mkfolder () {
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 [[ $prev == -in ||
2835 COMPREPLY=($(compgen -W "$(_folders $cur)"))
2839 function _mkproject () {
2856 cur="${COMP_WORDS[COMP_CWORD]}"
2857 prev="${COMP_WORDS[COMP_CWORD-1]}"
2859 if [[ $cur == -* ]]; then
2860 COMPREPLY=($(compgen -W "$opts" -- $cur))
2861 elif [[ $prev == -modcomp ]]; then
2862 COMPREPLY=($(compgen -W "$(_components $cur)"))
2863 elif [[ $prev == -in ]]; then
2864 COMPREPLY=($(compgen -W "$(_folders $cur)"))
2865 elif [[ $prev == -policy ||
2866 $prev == -npolicy ||
2867 $prev == -spolicy ]]; then
2868 COMPREPLY=($(compgen -W "$_policies" -- $cur))
2872 function _mkregion () {
2881 cur="${COMP_WORDS[COMP_CWORD]}"
2882 prev="${COMP_WORDS[COMP_CWORD-1]}"
2884 if [[ $cur == -* ]]; then
2885 COMPREPLY=($(compgen -W "$opts" -- $cur))
2886 elif [[ $prev == -tag ]]; then
2887 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
2891 function _mkstgloc () {
2906 cur="${COMP_WORDS[COMP_CWORD]}"
2907 prev="${COMP_WORDS[COMP_CWORD-1]}"
2909 if [[ $cur == -* ]]; then
2910 COMPREPLY=($(compgen -W "$opts" -- $cur))
2911 elif [[ $prev == -region ]]; then
2912 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
2913 elif [[ $prev == -host ]]; then
2914 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
2918 function _mkstream () {
2934 cur="${COMP_WORDS[COMP_CWORD]}"
2935 prev="${COMP_WORDS[COMP_CWORD-1]}"
2937 if [[ $cur == -* ]]; then
2938 COMPREPLY=($(compgen -W "$opts" -- $cur))
2939 elif [[ $prev == -amodcomp ]]; then
2940 COMPREPLY=($(compgen -W "$(_components $cur)"))
2941 elif [[ $prev == -baseline ]]; then
2942 COMPREPLY=($(compgen -W "$(_baselines $cur)"))
2943 elif [[ $prev == -in ]]; then
2944 COMPREPLY=($(compgen -W "$(_projects $cur)"))
2945 elif [[ $prev == -policy ||
2946 $prev == -npolicy ]]; then
2947 COMPREPLY=($(compgen -W "$(_policies $cur)" -- $cur))
2951 function _mktag () {
2969 cur="${COMP_WORDS[COMP_CWORD]}"
2970 prev="${COMP_WORDS[COMP_CWORD-1]}"
2971 prev2="$(COMP_WORDS[COMP_CWORD-2])"
2973 if [[ $cur == -* ]]; then
2974 COMPREPLY=($(compgen -W "$opts" -- $cur))
2975 elif [[ $prev2 == -view && $prev == "-tag" ]]; then
2976 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2977 elif [[ $prev2 == -vob && $prev == "-tag" ]]; then
2978 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2979 elif [[ $prev == -region ]]; then
2980 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
2981 elif [[ $prev == -host ]]; then
2982 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
2986 function _mktrtype () {
3017 cur="${COMP_WORDS[COMP_CWORD]}"
3018 prev="${COMP_WORDS[COMP_CWORD-1]}"
3020 if [[ $cur == -* ]]; then
3021 COMPREPLY=($(compgen -W "$opts" -- $cur))
3022 elif [[ $prev == -preop ||
3023 $prev == -postopt ]]; then
3024 COMPREPLY=($(compgen -W "$_operation_types" -- $cur))
3025 elif [[ $prev == -project ]]; then
3026 COMPREPLY=($(compgen -W "$(_projects $cur)"))
3027 elif [[ $prev == -stream ]]; then
3028 COMPREPLY=($(compgen -W "$(_streams $cur)"))
3029 elif [[ $prev == -component ]]; then
3030 COMPREPLY=($(compgen -W "$(_components $cur)"))
3031 elif [[ $prev == -folder ]]; then
3032 COMPREPLY=($(compgen -W "$(_folders $cur)"))
3033 elif [[ $prev == -activity ]]; then
3034 COMPREPLY=($(compgen -W "$(_activites $cur)" -- $cur))
3035 elif [[ $prev == -baseline ]]; then
3036 COMPREPLY=($(compgen -W "$(_baselines $cur)"))
3037 elif [[ $prev == -attype ]]; then
3038 COMPREPLY=($(compgen -W "$(_attypes $cur)"))
3039 elif [[ $prev == -brtype ]]; then
3040 COMPREPLY=($(compgen -W "$(_brtypes $cur)"))
3041 elif [[ $prev == -eltype ]]; then
3042 COMPREPLY=($(compgen -W "$(_eltypes $cur)"))
3043 elif [[ $prev == -hltype ]]; then
3044 COMPREPLY=($(compgen -W "$(_hltypes $cur)"))
3045 elif [[ $prev == -lbtype ]]; then
3046 COMPREPLY=($(compgen -W "$(_lbtypes $cur)"))
3047 elif [[ $prev == -trtypes ]]; then
3048 COMPREPLY=($(compgen -W "$(_trtypes $cur)"))
3052 function _mkview () {
3075 cur="${COMP_WORDS[COMP_CWORD]}"
3076 prev="${COMP_WORDS[COMP_CWORD-1]}"
3078 if [[ $cur == -* ]]; then
3079 COMPREPLY=($(compgen -W "$opts" -- $cur))
3080 elif [[ $prev == -tag ]]; then
3081 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3082 elif [[ $prev == -region ]]; then
3083 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
3084 elif [[ $prev == -stgloc ]]; then
3085 COMPREPLY=($(compgen -W "$(_stglocs $cur)"))
3086 elif [[ $prev == -host ]]; then
3087 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
3091 function _mkvob () {
3111 cur="${COMP_WORDS[COMP_CWORD]}"
3112 prev="${COMP_WORDS[COMP_CWORD-1]}"
3114 if [[ $cur == -* ]]; then
3115 COMPREPLY=($(compgen -W "$opts" -- $cur))
3116 elif [[ $prev == -tag ]]; then
3117 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3118 elif [[ $prev == -region ]]; then
3119 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
3120 elif [[ $prev == -stgloc ]]; then
3121 COMPREPLY=($(compgen -W "$(_stglocs $cur)"))
3122 elif [[ $prev == -host ]]; then
3123 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
3127 function _mount () {
3136 cur="${COMP_WORDS[COMP_CWORD]}"
3137 prev="${COMP_WORDS[COMP_CWORD-1]}"
3139 if [[ $cur == -* ]]; then
3140 COMPREPLY=($(compgen -W "$opts" -- $cur))
3141 elif [[ $cur == * ]]; then
3142 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3146 function _rebase () {
3173 cur="${COMP_WORDS[COMP_CWORD]}"
3174 prev="${COMP_WORDS[COMP_CWORD-1]}"
3176 if [[ $cur == -* ]]; then
3177 COMPREPLY=($(compgen -W "$opts" -- $cur))
3178 elif [[ $prev == -view ]]; then
3179 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3180 elif [[ $prev == -stream ]]; then
3181 COMPREPLY=($(compgen -W "$(_streams $cur)"))
3182 elif [[ $prev == -baseline ||
3183 $prev == -dbaseline ]]; then
3184 COMPREPLY=($(compgen -W "$(_baselines $cur)"))
3188 function _recoverview () {
3199 cur="${COMP_WORDS[COMP_CWORD]}"
3200 prev="${COMP_WORDS[COMP_CWORD-1]}"
3202 if [[ $cur == -* ]]; then
3203 COMPREPLY=($(compgen -W "$opts" -- $cur))
3204 elif [[ $prev == -tag ]]; then
3205 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3206 elif [[ $prev == -vob ]]; then
3207 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3211 function _reformatview () {
3220 cur="${COMP_WORDS[COMP_CWORD]}"
3221 prev="${COMP_WORDS[COMP_CWORD-1]}"
3223 if [[ $cur == -* ]]; then
3224 COMPREPLY=($(compgen -W "$opts" -- $cur))
3225 elif [[ $prev == -tag ]]; then
3226 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3230 function _reformatvob () {
3242 cur="${COMP_WORDS[COMP_CWORD]}"
3243 prev="${COMP_WORDS[COMP_CWORD-1]}"
3245 if [[ $cur == -* ]]; then
3246 COMPREPLY=($(compgen -W "$opts" -- $cur))
3247 elif [[ $prev == -host ]]; then
3248 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
3252 function _register () {
3264 cur="${COMP_WORDS[COMP_CWORD]}"
3265 prev="${COMP_WORDS[COMP_CWORD-1]}"
3267 if [[ $cur == -* ]]; then
3268 COMPREPLY=($(compgen -W "$opts" -- $cur))
3269 elif [[ $prev == -host ]]; then
3270 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
3274 function _rmactivity () {
3282 cur="${COMP_WORDS[COMP_CWORD]}"
3283 prev="${COMP_WORDS[COMP_CWORD-1]}"
3285 if [[ $cur == -* ]]; then
3286 COMPREPLY=($(compgen -W "$opts" -- $cur))
3287 elif [[ $cur == * ]]; then
3288 COMPREPLY=($(compgen -W "$(_activities $cur)"))
3292 function _rmattr () {
3301 cur="${COMP_WORDS[COMP_CWORD]}"
3302 prev="${COMP_WORDS[COMP_CWORD-1]}"
3304 if [[ $cur == -* ]]; then
3305 COMPREPLY=($(compgen -W "$opts" -- $cur))
3306 elif [[ $cur == * ]]; then
3307 COMPREPLY=($(compgen -W "$(_attypes $cur)"))
3319 cur="${COMP_WORDS[COMP_CWORD]}"
3320 prev="${COMP_WORDS[COMP_CWORD-1]}"
3322 if [[ $cur == -* ]]; then
3323 COMPREPLY=($(compgen -W "$opts" -- $cur))
3324 elif [[ $cur == * ]]; then
3325 COMPREPLY=($(compgen -W "$(_baselines $cur)"))
3329 function _rmcomp () {
3337 cur="${COMP_WORDS[COMP_CWORD]}"
3338 prev="${COMP_WORDS[COMP_CWORD-1]}"
3340 if [[ $cur == -* ]]; then
3341 COMPREPLY=($(compgen -W "$opts" -- $cur))
3342 elif [[ $cur == * ]]; then
3343 COMPREPLY=($(compgen -W "$(_components $cur)"))
3347 function _rmfolder () {
3355 cur="${COMP_WORDS[COMP_CWORD]}"
3356 prev="${COMP_WORDS[COMP_CWORD-1]}"
3358 if [[ $cur == -* ]]; then
3359 COMPREPLY=($(compgen -W "$opts" -- $cur))
3360 elif [[ $cur == * ]]; then
3361 COMPREPLY=($(compgen -W "$(_folders $cur)"))
3365 function _rmhlink () {
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 "$(_hltypes $cur)"))
3382 function _rmlabel () {
3392 cur="${COMP_WORDS[COMP_CWORD]}"
3393 prev="${COMP_WORDS[COMP_CWORD-1]}"
3395 if [[ $cur == -* ]]; then
3396 COMPREPLY=($(compgen -W "$opts" -- $cur))
3397 elif [[ $cur == * ]]; then
3398 COMPREPLY=($(compgen -W "$(_lbtypes $cur)"))
3402 function _rmproject () {
3411 cur="${COMP_WORDS[COMP_CWORD]}"
3412 prev="${COMP_WORDS[COMP_CWORD-1]}"
3414 if [[ $cur == -* ]]; then
3415 COMPREPLY=($(compgen -W "$opts" -- $cur))
3416 elif [[ $cur == * ]]; then
3417 COMPREPLY=($(compgen -W "$(_projects $cur)"))
3421 function _rmregion () {
3430 cur="${COMP_WORDS[COMP_CWORD]}"
3431 prev="${COMP_WORDS[COMP_CWORD-1]}"
3433 if [[ $cur == -* ]]; then
3434 COMPREPLY=($(compgen -W "$opts" -- $cur))
3435 elif [[ $prev == -tag ]]; then
3436 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
3440 function _rmstgloc () {
3449 cur="${COMP_WORDS[COMP_CWORD]}"
3450 prev="${COMP_WORDS[COMP_CWORD-1]}"
3452 if [[ $cur == -* ]]; then
3453 COMPREPLY=($(compgen -W "$opts" -- $cur))
3454 elif [[ $prev == -region ]]; then
3455 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
3456 elif [[ $cur == * ]]; then
3457 COMPREPLY=($(compgen -W "$(_stglocs $cur)"))
3461 function _rmstream () {
3470 cur="${COMP_WORDS[COMP_CWORD]}"
3471 prev="${COMP_WORDS[COMP_CWORD-1]}"
3473 if [[ $cur == -* ]]; then
3474 COMPREPLY=($(compgen -W "$opts" -- $cur))
3475 elif [[ $cur == * ]]; then
3476 COMPREPLY=($(compgen -W "$(_streams $cur)"))
3480 function _rmtag () {
3491 cur="${COMP_WORDS[COMP_CWORD]}"
3492 prev="${COMP_WORDS[COMP_CWORD-1]}"
3494 if [[ $cur == -* ]]; then
3495 COMPREPLY=($(compgen -W "$opts" -- $cur))
3496 elif [[ $prev == -view ]]; then
3497 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3498 elif [[ $prev == -vob ]]; then
3499 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3500 elif [[ $prev == -region ]]; then
3501 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
3505 function _rmtrigger () {
3515 cur="${COMP_WORDS[COMP_CWORD]}"
3516 prev="${COMP_WORDS[COMP_CWORD-1]}"
3518 if [[ $cur == -* ]]; then
3519 COMPREPLY=($(compgen -W "$opts" -- $cur))
3520 elif [[ $cur == * ]]; then
3521 COMPREPLY=($(compgen -W "$(_trtypes $cur)"))
3525 function _rmtype () {
3535 cur="${COMP_WORDS[COMP_CWORD]}"
3536 prev="${COMP_WORDS[COMP_CWORD-1]}"
3538 if [[ $cur == -* ]]; then
3539 COMPREPLY=($(compgen -W "$opts" -- $cur))
3540 elif [[ $cur == * ]]; then
3545 function _rmview () {
3557 cur="${COMP_WORDS[COMP_CWORD]}"
3558 prev="${COMP_WORDS[COMP_CWORD-1]}"
3560 if [[ $cur == -* ]]; then
3561 COMPREPLY=($(compgen -W "$opts" -- $cur))
3562 elif [[ $prev == -tag ]]; then
3563 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3564 elif [[ $prev == -vob ]]; then
3565 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3569 function _rmvob () {
3576 cur="${COMP_WORDS[COMP_CWORD]}"
3577 prev="${COMP_WORDS[COMP_CWORD-1]}"
3579 if [[ $cur == -* ]]; then
3580 COMPREPLY=($(compgen -W "$opts" -- $cur))
3581 elif [[ $cur == * ]]; then
3582 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3586 function _setcs () {
3602 cur="${COMP_WORDS[COMP_CWORD]}"
3603 prev="${COMP_WORDS[COMP_CWORD-1]}"
3605 if [[ $cur == -* ]]; then
3606 COMPREPLY=($(compgen -W "$opts" -- $cur))
3607 elif [[ $cur == -tag ]]; then
3608 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3612 function _setplevel () {
3621 cur="${COMP_WORDS[COMP_CWORD]}"
3622 prev="${COMP_WORDS[COMP_CWORD-1]}"
3624 if [[ $cur == -* ]]; then
3625 COMPREPLY=($(compgen -W "$opts" -- $cur))
3626 elif [[ $prev == -invob ]]; then
3627 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3631 function _setview() {
3639 cur="${COMP_WORDS[COMP_CWORD]}"
3640 prev="${COMP_WORDS[COMP_CWORD-1]}"
3642 if [[ $cur == -* && $ARCHITECTURE != cygwin ]]; then
3643 COMPREPLY=($(compgen -W "$opts" -- $cur))
3644 elif [[ $cur == * ]]; then
3645 COMPREPLY=($(compgen -W "$(_views $cur)"))
3649 function _space () {
3664 cur="${COMP_WORDS[COMP_CWORD]}"
3665 prev="${COMP_WORDS[COMP_CWORD-1]}"
3667 if [[ $cur == -* ]]; then
3668 COMPREPLY=($(compgen -W "$opts" -- $cur))
3669 elif [[ $prev == -view ]]; then
3670 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3671 elif [[ $prev == -vob || $cur == * ]]; then
3672 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3676 function _startview () {
3682 cur="${COMP_WORDS[COMP_CWORD]}"
3683 prev="${COMP_WORDS[COMP_CWORD-1]}"
3685 if [[ $cur == -* ]]; then
3686 COMPREPLY=($(compgen -W "$opts" -- $cur))
3687 elif [[ $cur == * ]]; then
3688 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3692 function _umount () {
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 "$(_vobs $cur)"))
3709 function _unlock () {
3718 cur="${COMP_WORDS[COMP_CWORD]}"
3719 prev="${COMP_WORDS[COMP_CWORD-1]}"
3721 if [[ $cur == -* ]]; then
3722 COMPREPLY=($(compgen -W "$opts" -- $cur))
3723 elif [[ $cur == * ]]; then
3724 COMPREPLY=($(compgen -W "$(_object_selector $cur)" -- $cur))
3732 cur="${COMP_WORDS[COMP_CWORD]}"
3733 cmd="${COMP_WORDS[0]}"
3734 subcmd="${COMP_WORDS[1]}"
3736 if [[ $cmd == scm || $cmd == ct ]]; then
3737 if [[ $COMP_CWORD == 1 ]]; then
3738 COMPREPLY=($(compgen -W "$_scm_cmds" -- $cur))
3742 COMPREPLY=($(compgen -W "$_annotate_opts" -- $cur));;
3744 COMPREPLY=($(compgen -W "$_catcr_opts" -- $cur));;
3750 COMPREPLY=($(compgen -W "$_chbl_opts" -- $cur));;
3754 COMPREPLY=($(compgen -W "$_checkout_opts" -- $cur));;
3760 COMPREPLY=($(compgen -W "$_chflevel_opts" -- $cur));;
3766 COMPREPLY=($(compgen -W "$_chpool_opts" -- $cur));;
3772 COMPREPLY=($(compgen -W "$_chtype_opts" -- $cur));;
3780 COMPREPLY=($(compgen -W "$_diff_opts" -- $cur));;
3782 COMPREPLY=($(compgen -W "$_diffbl_opts" -- $cur));;
3784 COMPREPLY=($(compgen -W "$_diffcr_opts" -- $cur));;
3794 COMPREPLY=($(compgen -W "$_find_opts" -- $cur));;
3796 COMPREPLY=($(compgen -W "$_findmerge_opts" -- $cur));;
3798 COMPREPLY=($(compgen -W "$_get_opts" -- $cur));;
3800 COMPREPLY=($(compgen -W "$_getcache_opts" -- $cur));;
3804 COMPREPLY=($(compgen -W "$_scm_cmds" -- $cur));;
3808 COMPREPLY=($(compgen -W "$_ln_opts" -- $cur));;
3810 COMPREPLY=($(compgen -W "$_ls_opts" -- $cur));;
3816 COMPREPLY=($(compgen -W "$_lscheckout_opts" -- $cur));;
3822 COMPREPLY=($(compgen -W "$_lsdo_opts" -- $cur));;
3826 COMPREPLY=($(compgen -W "$_lshistory_opts" -- $cur));;
3828 COMPREPLY=($(compgen -W "$_lslock_opts" -- $cur));;
3830 COMPREPLY=($(compgen -W "$_lsmaster_opts" -- $cur));;
3840 COMPREPLY=($(compgen -W "$_lsreplica_opts" -- $cur));;
3842 COMPREPLY=($(compgen -W "$_lssite_opts" -- $cur));;
3854 COMPREPLY=($(compgen -W "$_lsvtree_opts" -- $cur));;
3856 COMPREPLY=($(compgen -W "$_scm_cmds" -- $cur));;
3858 COMPREPLY=($(compgen -W "$_merge_opts" -- $cur));;
3862 COMPREPLY=($(compgen -W "$_mkattr_opts" -- $cur));;
3864 COMPREPLY=($(compgen -W "$_mkattype_opts" -- $cur));;
3868 COMPREPLY=($(compgen -W "$_mkbranch_opts" -- $cur));;
3870 COMPREPLY=($(compgen -W "$_mkbrtype_opts" -- $cur));;
3874 COMPREPLY=($(compgen -W "$_mkdir_opts" -- $cur));;
3876 COMPREPLY=($(compgen -W "$_mkelem_opts" -- $cur));;
3878 COMPREPLY=($(compgen -W "$_mkeltype_opts" -- $cur));;
3882 COMPREPLY=($(compgen -W "$_mkhlink_opts" -- $cur));;
3884 COMPREPLY=($(compgen -W "$_mkhltype_opts" -- $cur));;
3886 COMPREPLY=($(compgen -W "$_mklabel_opts" -- $cur));;
3888 COMPREPLY=($(compgen -W "$_mklbtype_opts" -- $cur));;
3890 COMPREPLY=($(compgen -W "$_mkpool_opts" -- $cur));;
3902 COMPREPLY=($(compgen -W "$_mktrigger_opts" -- $cur));;
3912 COMPREPLY=($(compgen -W "$_move_opts" -- $cur));;
3914 COMPREPLY=($(compgen -W "$_protect_opts" -- $cur));;
3916 COMPREPLY=($(compgen -W "$_protectvob_opts" -- $cur));;
3918 COMPREPLY=($(compgen -W "$_pwd_opts" -- $cur));;
3920 COMPREPLY=($(compgen -W "$_pwv_opts" -- $cur));;
3932 COMPREPLY=($(compgen -W "$_relocate_opts" -- $cur));;
3934 COMPREPLY=($(compgen -W "$_rename_opts" -- $cur));;
3936 COMPREPLY=($(compgen -W "$_reqmaster_opts" -- $cur));;
3938 COMPREPLY=($(compgen -W "$_reserve_opts" -- $cur));;
3946 COMPREPLY=($(compgen -W "$_rmbranch_opts" -- $cur));;
3950 COMPREPLY=($(compgen -W "$_rmdo_opts" -- $cur));;
3952 COMPREPLY=($(compgen -W "$_rmelem_opts" -- $cur));;
3960 COMPREPLY=($(compgen -W "$_rmmerge_opts" -- $cur));;
3962 COMPREPLY=($(compgen -W "$_rmname_opts" -- $cur));;
3964 COMPREPLY=($(compgen -W "$_rmpool_opts" -- $cur));;
3980 COMPREPLY=($(compgen -W "$_rmver_opts" -- $cur));;
3986 COMPREPLY=($(compgen -W "$_schedule_opts" -- $cur));;
3988 COMPREPLY=($(compgen -W "$_setcache_opts" -- $cur));;
3996 COMPREPLY=($(compgen -W "$_setsite_opts" -- $cur));;
4004 COMPREPLY=($(compgen -W "$_uncheckout_opts" -- $cur));;
4008 COMPREPLY=($(compgen -W "$_unregister_opts" -- $cur));;
4010 COMPREPLY=($(compgen -W "$_unreserve_opts" -- $cur));;
4012 COMPREPLY=($(compgen -W "$_update_opts" -- $cur));;
4014 COMPREPLY=($(compgen -W "$_winkin_opts" -- $cur));;
4020 # TODO: These functions aren't working very well yet.
4021 function _type_selector () {
4022 local cur prev prev2
4024 cur="${COMP_WORDS[COMP_CWORD]}"
4026 if (($COMP_CWORD - 1 >= 0)); then
4027 prev="${COMP_WORDS[COMP_CWORD-1]}"
4030 if (($COMP_CWORD - 2 >= 0)); then
4031 prev2="${COMP_WORDS[COMP_CWORD-2]}"
4034 if [[ $prev == : ]]; then
4035 COMPREPLY=($(compgen -W "$(ct lstype -kind $prev2 -short -invob $dvob | grep ^$cur)" -- $cur))
4036 elif [[ $cur == : ]]; then
4037 COMPREPLY=($(compgen -W "$(ct lstype -kind $prev -short -invob $dvob)"))
4038 elif [[ $cur == * ]]; then
4039 COMPREPLY=($(compgen -W "$_type_selectors" -- $cur))
4043 function _object_selector () {
4044 local cur prev prev2
4048 cur="${COMP_WORDS[COMP_CWORD]}"
4050 if (($COMP_CWORD - 1 >= 0)); then
4051 prev="${COMP_WORDS[COMP_CWORD-1]}"
4054 if (($COMP_CWORD - 2 >= 0)); then
4055 prev2="${COMP_WORDS[COMP_CWORD-2]}"
4058 if [[ $prev == activity || ($prev == : && $prev2 == activity) ]]; then
4059 if [[ $cur == : ]]; then
4060 COMPREPLY=($(compgen -W "$(_activities)" -- ""))
4063 COMPREPLY=($(compgen -W "$(_activities $cur)"))
4064 echo "COMPREPLY = ${COMPREPLY[*]}"
4066 elif [[ $prev == lbtype || ($prev == : && $prev2 == lbtype) ]]; then
4067 if [[ $cur == : ]]; then
4068 COMPREPLY=($(compgen -W "$(_lbtypes)" -- ""))
4069 echo "COMPREPLY = ${COMPREPLY[*]}"
4072 COMPREPLY=($(compgen -W "$(_lbtypes $cur)"))
4073 echo "COMPREPLY = ${COMPREPLY[*]}"
4075 elif [[ $cur == * ]] ; then
4076 COMPREPLY=($(compgen -W "$_object_selectors" -- $cur))
4078 } # _object_selector
4080 complete -o default -F _scm scm ct
4082 complete -F _catcs catcs
4083 complete -F _checkin ci
4084 complete -F _deliver deliver
4085 complete -F _endview endview
4086 complete -F _lsactivity lsact
4087 complete -F _lsbl lsbl
4088 complete -F _lsproject lsproj
4089 complete -F _lsfolder lsfolder llfolder
4090 complete -F _lsstgloc lsstgloc
4091 complete -F _lsstream lsstream llstream
4092 complete -F _lsview lsview llview
4093 complete -F _lsvob lsvob llvob
4094 complete -F _merge merge
4095 complete -F _mktag mktag
4096 complete -F _mkview mkview
4097 complete -F _rebase rebase
4098 complete -F _rmtag rmtag
4099 complete -F _rmview rmview
4100 complete -F _setactivity setact
4101 complete -F _setcs setcs
4102 complete -F _setview setview
4103 complete -F _startview startview
4104 complete -F _space space
4105 complete -F _register register
4106 complete -F _uncheckout unco
4107 complete -F _unregister unregister
4109 complete -F _object_selector -o nospace lstype
4110 complete -F _object_selector -o nospace lltype
4111 complete -F _object_selector -o nospace lslock
4112 complete -F _object_selector -o nospace lllock