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 # The following should work but fails because they are using /c to mount
19 # the C drive and that messes things up.
20 export CCHOME=$(cygpath -u "$(regtool get '/machine/SOFTWARE/Atria/ClearCase/CurrentVersion/ProductHome' 2>/dev/null)" 2>/dev/null)
21 export CCHOME=/opt/rational/clearcase
23 export CCHOME="/opt/rational/clearcase"
26 if [ ! -d "$CCHOME" ]; then
31 # Source in clearcase.conf
32 if [ -f ~/.rc/clearcase.conf ]; then
33 source ~/.rc/clearcase.conf
35 echo "WARNING: Could not find ~/.rc/clearcase.conf - functionality will be limted"
38 export CLEARTOOL="$CCHOME/bin/cleartool"
39 export CLEARCASE_BLD_HOST_TYPE="unix"
41 if [ -f "$CCHOME/etc/utils/creds" ]; then
42 if [ $ARCHITECTURE = 'cygwin' ]; then
43 alias creds=$(cygpath "$CCHOME/etc/utils/creds")
45 alias creds="$CCHOME/etc/utils/creds"
49 if [ -x "$CLEARTOOL" ]; then
50 export RGY="$CCHOME/var/atria/rgy"
51 export LOGS="$CCHOME/var/log"
57 if [ -x "$CLEARTOOL" ]; then
58 # Cleartool suddenly started appending ^M's (I think as of 7.1)
59 if [ $ARCHITECTURE = 'cygwin' ]; then
60 # Need to set pipefail to pick up the exit code from cleartool
61 # otherwise we get the exit code from tr which is usually 0
63 "$CLEARTOOL" "$@" | tr -d "\015"
78 # Setview is special - there is no setview on Windows. But we approximate it
79 # with the function setview
80 if [ "$1" = "setview" ]; then
91 if [ "$(scm pwv)" != '' ]; then
93 elif [ -f CVS/Root ]; then
102 echo "ci: Error: No files specified"
110 echo "co: Error: No files specified"
118 echo "unco: Error: No files specified"
129 scm lslock -long "$@"
132 # View related functions
134 if [ $ARCHITECTURE = 'cygwin' ]; then
135 if [[ $1 = -* ]]; then
136 echo "The setview command with options is not supported on Windows"
140 # Save off where we are
150 # Setup $VOBTAG_PREFIX
151 mount -f -o binary M:/$1 $LINUX_VOBTAG_PREFIX
156 # Remove $LINUX_VOBTAG_PREFIX mount (Ignore errors)
157 umount $LINUX_VOBTAG_PREFIX 2> /dev/null
159 # Chdir back to were we started
180 scm endview -server "$@"
189 echo "Usage: $FUNCNAME <stream>"
195 # Check to see if the view already exists
196 scm lsview -short ${USER}_$stream > /dev/null 2>&1
199 echo "${USER}_$stream already exists!"
201 mkview -tag ${USER}_$stream -stream $stream@$pvob -stgloc -auto
204 echo "Couldn't find that stream. Perhaps it's one of these?"
206 searchFor=${stream:1:$i}
207 scm lsstream -short -invob $pvob | grep $searchFor | $PAGER
212 setview ${USER}_$stream
221 scm lsview -s | $PAGER
222 elif [ $# = 1 ]; then
223 scm lsview -s | grep "$1"
230 # Well they asked for my "views"...
231 if [ $(whence fortune) ]; then
236 # List my views and their associated activities
237 for view in $(scm lsview -s 2>&1 | grep $USER); do
238 headline=$(scm lsact -cact -fmt "%[headline]p" -view $view 2> /dev/null)
240 if [ "$headline" = "" ]; then
241 headline="<no activity set>"
244 echo -e "$view\t$headline"
250 scm lsview -long | $PAGER
252 scm lsview -long "$@"
260 scm lsview -short | grep $1
264 # Vob related functions
268 elif [ $# = 1 ]; then
269 scm lsvob | grep "$1"
277 scm lsvob -long | $PAGER
287 scm lsvob -short | grep $1
291 # Config spec functions
328 elif [ $# == 1 ]; then
332 echo "Usage: oid2name: <oid> [<pvob>]"
337 scm describe oid:$oid@$projvob 2> /dev/null | head -1
345 elif [ $# == 2 ]; then
350 echo "Usage: name2oid: <type> <name> [<pvob>]"
355 scm dump $type:$name@$projvob 2> /dev/null | grep oid=
361 echo "vtree: Error: Must specify an element to view its version tree"
363 if [ $ARCHITECTURE = 'cygwin' ]; then
380 scmsystem; scmtype=$?
383 if [ $scmtype = 1 ]; then
384 scm diff -graphical -pred $1
385 elif [ $scmtype = 2 ]; then
389 if [ $scmtype = 1 ]; then
390 scm diff -graphical "$@"
391 elif [ $scmtype = 2 ]; then
399 scm xdiff -vstack -pred $1
405 # Administrative functions
414 function unregister {
418 # Information functions
427 scm lstype trtype:$trig_name@$vob
429 scm lstype -kind trtype "$@" | $PAGER
435 scm lstype -long trtype:$1
437 scm lstype -long -kind trtype "$@"| $PAGER
449 # UCM oriented functions
452 # If we are in a view context then try to list the stream for our view
453 if [[ $(pwv) == "** NONE **" ]]; then
456 scm lsstream | $PAGER
459 # Check to see if a pvob was specified
460 if [[ $@ == *@* ]]; then
463 scm lsstream -invob $pvob | grep $1 | $PAGER
470 scm lsstream -l | $PAGER
478 scm lsstream -short -invob $pvob
480 scm lsstream -short "$@"
484 function lsregions () {
485 if [ $# -gt 0 ]; then
486 scm lsregion -short | grep ^$1
510 scm lsproject | $PAGER
518 scm lsproject -l | $PAGER
520 scm lsproject -l "$@"
529 scm lsfolder -long "$@"
534 scm lsstgloc | $PAGER
542 scm lsstgloc -l | $PAGER
550 scm lsactivity | $PAGER
558 scm lsactivity -l | $PAGER
560 scm lsactivity -l "$@"
566 echo "What? Am I suppose to guess?!?"
574 scmsystem; scmtype=$?
576 if [ $scmtype = 1 ]; then
577 scm lsco -short -cview -all -me
578 elif [ $scmtype = 2 ]; then
579 cvs -Q status | grep ^File | grep -v Up-to-date
587 # Bash completion for Clearcase commands. T
589 # Add "," to COMP_BREAKWORDS
590 COMP_WORDBREAKS=\ \"\'\>\<\=\;\|\&\(\:\,
592 # All Clearcase commands
759 # These options are common to all scm commands. So far -help is the only one
763 # Comment opts. These options are common for commands that request the user
772 # Individual command options
1489 _setactivity_opts="\
1579 _object_selectors="\
1656 if [ $ARCHITECTURE = 'cygwin' ]; then
1658 POLICY_WIN_INT_SNAP \
1659 POLICY_WIN_DEV_SNAP \
1663 POLICY_UNIX_INT_SNAP \
1664 POLICY_UNIX_DEV_SNAP \
1670 POLICY_CHPROJECT_UNRESTRICED \
1671 POLICY_DELIVER_REQUIRE_REBASE \
1672 POLICY_DELIVER_NCO_DEVSTR \
1673 POLICY_DELIVER_NOCO_SELACTS \
1675 POLICY_INTRAPROJECT_DELIVER_FOUNDATION_CHANGES \
1676 POLICY_INTRAPROJECT_DELIVER_ALLOW_MISSING_TGTCOMPS \
1677 POLICY_INTERPROJECT_DELIVER \
1678 POLICY_INTERPROJECT_DELIVER_FOUNDATION_CHANGES \
1679 POLICY_INTERPROJECT_DELIVER_REQUIRE_TGTCOMP_VISIBIITY \
1680 POLICY_INTERPROJECT_DELIVER_ALLOW_NONMOD_TGTCOMPS \
1684 function set_pvob () {
1685 if [ $# -eq 1 ]; then
1690 function set_dvob () {
1691 if [ $# -eq 1 ]; then
1696 # Listing type functions. These functions produce a list of some object and are
1697 # used by the various completion functions.
1698 function _attypes () {
1699 if [ $# -gt 0 ]; then
1700 scm lstype -kind attype -invob $pvob -fmt "%n " | grep ^$1
1702 scm lstype -kind attype -invob $pvob -fmt "%n "
1706 function _activities () {
1707 if [ $# -gt 0 ]; then
1708 scm lsactivity -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1710 scm lsactivity -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1714 function _baselines () {
1715 stream=$(scm lsstream -short 2> /dev/null)
1717 if [ -z $stream ]; then
1721 if [ $# -ge 0 ]; then
1722 scm lsbl -stream $stream@$pvob -short | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1724 scm lsbl -stream $stream@$pvob -short | sed "s:$:@$vobtagPrefix$pvob:"
1728 function _brtypes () {
1729 if [ $# -gt 0 ]; then
1730 scm lstype -kind brtype -invob $pvob -fmt "%n\n" | grep ^$1
1732 scm lstype -kind brtype -invob $pvob -fmt "%n\n"
1736 function _cchosts () {
1737 registryHost=$(scm hostinfo -long | grep "Registry host:" | awk '{print $NF}')
1739 scm lsclients -short -host $registryHost | tr [:upper:] [:lower:]
1742 function _components () {
1743 if [ $# -gt 0 ]; then
1744 scm lscomp -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1746 scm lscomp -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1750 function _eltypes () {
1751 if [ $# -gt 0 ]; then
1752 scm lstype -kind eltype -invob $pvob -fmt "%n " | grep ^$1
1754 scm lstype -kind eltype -invob $pvob -fmt "%n "
1758 function _folders () {
1759 if [ $# -gt 0 ]; then
1760 scm lsfolder -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1762 scm lsfolder -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1766 function _hltypes () {
1767 if [ $# -gt 0 ]; then
1768 scm lstype -kind hltype -invob $pvob -fmt "%n " | grep ^$1
1770 scm lstype -kind hltype -invob $pvob -fmt "%n "
1774 function _lbtypes () {
1775 if [ $# -gt 0 ]; then
1776 scm lstype -kind lbtype -invob $pvob -fmt "%n@$vobtagPrefix$pvob " | grep ^$1
1778 scm lstype -kind lbtype -invob $pvob -fmt "%n@$vobtagPrefix$pvob "
1782 function _projects () {
1783 if [ $# -gt 0 ]; then
1784 scm lsproject -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1786 scm lsproject -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1790 function _streams () {
1791 if [ $# -gt 0 ]; then
1792 scm lsstream -short -invob $pvob | grep ^$1 | sed "s:$:@$vobtagPrefix$pvob:"
1794 scm lsstream -short -invob $pvob | sed "s:$:@$vobtagPrefix$pvob:"
1798 function _stglocs () {
1799 if [ $# -gt 0 ]; then
1800 scm lsstgloc -short | grep ^$1
1806 function _views () {
1807 if [ $# -gt 0 ]; then
1808 scm lsview -short | grep ^$1;
1815 # We simply must rid ourselves of these bloody backlashes!!! And yet Clearcase
1816 # insists on retaining them. Let's strip them off, do our thing, then put them
1817 # back to backslashes when we output stuff.
1818 if [ $ARCHITECTURE = 'cygwin' ]; then
1819 if [ $# -eq 0 ]; then
1820 scm lsvob -short | sed 's:\\:\\\\\\\\:'
1822 # Convert to foward slashes
1823 vob=$(echo $1 | sed 's:\\::g')
1825 scm lsvob -short | sed 's:\\::' | grep ^$vob | sed 's:^:\\\\\\\\:'
1828 if [ $# -eq 0 ]; then
1831 scm lsvob -short | grep ^$1
1836 function _trtypes () {
1837 if [ $# -gt 0 ]; then
1838 scm lstype -kind trtype -invob $pvob -fmt "%n " | grep ^$1
1840 scm lstype -kind trtype -invob $pvob -fmt "%n "
1844 # Completion functions for individual commands where the completion may change
1845 # depending on the operation. For example, typing "scm catcs -tag " should
1846 # now complete based on view tags whereas "scm catcs -" should just complete
1847 # based on options (which are only -help and -tag at this point for this
1848 # particular command). If a command does not have a "completer function" then
1849 # it will only provide for options completion and will be handled by the general
1850 # _scm completion function.
1851 function _catcs () {
1858 cur="${COMP_WORDS[COMP_CWORD]}"
1859 prev="${COMP_WORDS[COMP_CWORD-1]}"
1861 if [[ $cur == -* ]]; then
1862 COMPREPLY=($(compgen -W "$opts" -- $cur))
1863 elif [[ $prev == -tag ]]; then
1864 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
1868 function _chactivity () {
1881 cur="${COMP_WORDS[COMP_CWORD]}"
1882 prev="${COMP_WORDS[COMP_CWORD-1]}"
1884 if [[ $cur == -* ]]; then
1885 COMPREPLY=($(compgen -W "$opts" -- $cur))
1886 elif [[ $prev == -fcset || $prev == -tcset ]]; then
1887 COMPREPLY=($(compgen -W "$(_activities $cur)"))
1888 elif [[ $prev == -view ]]; then
1889 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
1893 function _checkin () {
1894 local cur prev prev2
1907 cur="${COMP_WORDS[COMP_CWORD]}"
1908 prev="${COMP_WORDS[COMP_CWORD-1]}"
1909 prev2="${COMP_WORDS[COMP_CWORD-2]}"
1911 if [[ $cur == -* ]]; then
1912 COMPREPLY=($(compgen -W "$opts" -- $cur))
1913 elif [[ $prev2 == activity && $prev == : ]]; then
1914 COMPREPLY=($(compgen -W "$(_activities $cur)"))
1918 function _checkvob () {
1953 cur="${COMP_WORDS[COMP_CWORD]}"
1954 prev="${COMP_WORDS[COMP_CWORD-1]}"
1956 if [[ $cur == -* ]]; then
1957 COMPREPLY=($(compgen -W "$opts" -- $cur))
1958 elif [[ $prev == -view ]]; then
1959 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
1963 function _chevent () {
1976 cur="${COMP_WORDS[COMP_CWORD]}"
1977 prev="${COMP_WORDS[COMP_CWORD-1]}"
1979 if [[ $cur == -* ]]; then
1980 COMPREPLY=($(compgen -W "$opts" -- $cur))
1981 elif [[ $prev == -invob ]]; then
1982 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
1983 elif [[ $cur == * ]]; then
1984 COMPREPLY=($(compgen -W "$_object_selectors" -- $cur))
1988 function _chfolder () {
1996 cur="${COMP_WORDS[COMP_CWORD]}"
1997 prev="${COMP_WORDS[COMP_CWORD-1]}"
1999 if [[ $cur == -* ]]; then
2000 COMPREPLY=($(compgen -W "$opts" -- $cur))
2001 elif [[ $prev == -to ]]; then
2002 COMPREPLY=($(compgen -W "$(_folders $cur)"))
2003 elif [[ $cur == * ]]; then
2004 COMPREPLY=($(compgen -W "$(_folders $cur)"))
2008 function _chmaster () {
2023 cur="${COMP_WORDS[COMP_CWORD]}"
2024 prev="${COMP_WORDS[COMP_CWORD-1]}"
2026 if [[ $cur == -* ]]; then
2027 COMPREPLY=($(compgen -W "$opts" -- $cur))
2028 elif [[ $prev == -stream ]]; then
2029 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2030 elif [[ $cur == -view ]]; then
2031 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2035 function _chproject () {
2055 cur="${COMP_WORDS[COMP_CWORD]}"
2056 prev="${COMP_WORDS[COMP_CWORD-1]}"
2058 if [[ $cur == -* ]]; then
2059 COMPREPLY=($(compgen -W "$opts" -- $cur))
2060 elif [[ $prev == -amodcomp ||
2061 $prev == -dmodcomp ]]; then
2062 COMPREPLY=($(compgen -W "$(_components $cur)"))
2063 elif [[ $prev == -to ]]; then
2064 COMPREPLY=($(compgen -W "$(_folders $cur)"))
2065 elif [[ $prev == -policy ||
2066 $prev == -npolicy ||
2067 $prev == -spolicy ]]; then
2068 COMPREPLY=($(compgen -W "$_policies" -- $cur))
2069 elif [[ $cur == * ]]; then
2070 COMPREPLY=($(compgen -W "$(_projects $cur)"))
2074 function _chstream () {
2093 cur="${COMP_WORDS[COMP_CWORD]}"
2094 prev="${COMP_WORDS[COMP_CWORD-1]}"
2096 if [[ $cur == -* ]]; then
2097 COMPREPLY=($(compgen -W "$opts" -- $cur))
2098 elif [[ $prev == -amodcomp ||
2099 $prev == -dmodcomp ]]; then
2100 COMPREPLY=($(compgen -W "$(_components $cur)"))
2101 elif [[ $prev == -policy ||
2102 $prev == -npolicy ]]; then
2103 COMPREPLY=($(compgen -W "$_policies" -- $cur))
2104 elif [[ $prev == , || $prev == -recommended || $cur == , ]]; then
2105 if [[ $cur == , ]]; then
2108 COMPREPLY=($(compgen -W "$(_baselines $cur)"))
2109 elif [[ $prev == -target || $cur == * ]]; then
2110 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2114 function _chview () {
2128 cur="${COMP_WORDS[COMP_CWORD]}"
2129 prev="${COMP_WORDS[COMP_CWORD-1]}"
2131 if [[ $cur == -* ]]; then
2132 COMPREPLY=($(compgen -W "$opts" -- $cur))
2133 elif [[ $prev == -stream ]]; then
2134 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2135 elif [[ $prev == * ]]; then
2136 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2140 function _deliver () {
2158 cur="${COMP_WORDS[COMP_CWORD]}"
2159 prev="${COMP_WORDS[COMP_CWORD-1]}"
2161 if [[ $cur == -* ]]; then
2162 COMPREPLY=($(compgen -W "$opts" -- $cur))
2163 elif [[ $prev == -stream || $prev == -target ]]; then
2164 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2165 elif [[ $prev == -to ]]; then
2166 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2167 elif [[ $prev == -activities ]]; then
2168 COMPREPLY=($(compgen -W "$(_activities $cur)"))
2172 function _describe () {
2193 cur="${COMP_WORDS[COMP_CWORD]}"
2194 prev="${COMP_WORDS[COMP_CWORD-1]}"
2196 if [[ $cur == -* ]]; then
2197 COMPREPLY=($(compgen -W "$opts" -- $cur))
2198 elif [[ $cur == * ]]; then
2199 COMPREPLY=($(compgen -W "$_object_selectors" -- $cur))
2203 function _dospace () {
2218 cur="${COMP_WORDS[COMP_CWORD]}"
2219 prev="${COMP_WORDS[COMP_CWORD-1]}"
2221 if [[ $cur == -* ]]; then
2222 COMPREPLY=($(compgen -W "$opts" -- $cur))
2223 elif [[ $prev == -region ]]; then
2224 COMPREPLY=($(compgen -W "$(lsregions)" -- $cur))
2239 cur="${COMP_WORDS[COMP_CWORD]}"
2240 prev="${COMP_WORDS[COMP_CWORD-1]}"
2242 if [[ $cur == -* ]]; then
2243 COMPREPLY=($(compgen -W "$opts" -- $cur))
2244 elif [[ $prev == -tag ]]; then
2245 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2249 function _endview () {
2256 cur="${COMP_WORDS[COMP_CWORD]}"
2257 prev="${COMP_WORDS[COMP_CWORD-1]}"
2259 if [[ $cur == -* ]]; then
2260 COMPREPLY=($(compgen -W "$opts" -- $cur))
2261 elif [[ $prev == * ]]; then
2262 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2274 cur="${COMP_WORDS[COMP_CWORD]}"
2275 prev="${COMP_WORDS[COMP_CWORD-1]}"
2277 if [[ $cur == -* ]]; then
2278 COMPREPLY=($(compgen -W "$opts" -- $cur))
2279 elif [[ $prev == -invob ]]; then
2280 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2284 function _getlog () {
2301 cur="${COMP_WORDS[COMP_CWORD]}"
2302 prev="${COMP_WORDS[COMP_CWORD-1]}"
2304 if [[ $cur == -* ]]; then
2305 COMPREPLY=($(compgen -W "$opts" -- $cur))
2306 elif [[ $prev == -tag || $prev == -target ]]; then
2307 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2308 elif [[ $prev == -vob ]]; then
2309 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2310 elif [[ $prev == -host ]]; then
2311 COMPREPLY=($(compgen -W "$(_cchosts)" -- $cur))
2315 function _hostinfo () {
2324 cur="${COMP_WORDS[COMP_CWORD]}"
2325 prev="${COMP_WORDS[COMP_CWORD-1]}"
2327 if [[ $cur == -* ]]; then
2328 COMPREPLY=($(compgen -W "$opts" -- $cur))
2329 elif [[ $cur == * ]]; then
2330 COMPREPLY=($(compgen -W "$(_cchosts)" -- $cur))
2334 function _lsactivity () {
2356 cur="${COMP_WORDS[COMP_CWORD]}"
2357 prev="${COMP_WORDS[COMP_CWORD-1]}"
2359 if [[ $cur == -* ]]; then
2360 COMPREPLY=($(compgen -W "$opts" -- $cur))
2361 elif [[ $prev == -invob ]]; then
2362 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2363 elif [[ $prev == -in ]]; then
2364 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2365 elif [[ $prev == -view ]]; then
2366 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2367 elif [[ $cur == * ]]; then
2368 COMPREPLY=($(compgen -W "$(_activities $cur)"))
2391 cur="${COMP_WORDS[COMP_CWORD]}"
2392 prev="${COMP_WORDS[COMP_CWORD-1]}"
2394 if [[ $cur == -* ]]; then
2395 COMPREPLY=($(compgen -W "$opts" -- $cur))
2396 elif [[ $prev == -component ]]; then
2397 COMPREPLY=($(compgen -W "$(_components $cur)"))
2398 elif [[ $prev == -stream ]]; then
2399 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2403 function _lsclients () {
2413 cur="${COMP_WORDS[COMP_CWORD]}"
2414 prev="${COMP_WORDS[COMP_CWORD-1]}"
2416 if [[ $cur == -* ]]; then
2417 COMPREPLY=($(compgen -W "$opts" -- $cur))
2418 elif [[ $prev == -host ]]; then
2419 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
2423 function _lscomp () {
2435 cur="${COMP_WORDS[COMP_CWORD]}"
2436 prev="${COMP_WORDS[COMP_CWORD-1]}"
2438 if [[ $cur == -* ]]; then
2439 COMPREPLY=($(compgen -W "$opts" -- $cur))
2440 elif [[ $prev == -invob ]]; then
2441 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2442 elif [[ $cur == * ]]; then
2443 COMPREPLY=($(compgen -W "$(_components $cur)"))
2447 function _lsfolder () {
2463 local lopts="$opts -long"
2465 cur="${COMP_WORDS[COMP_CWORD]}"
2466 prev="${COMP_WORDS[COMP_CWORD-1]}"
2468 if [[ $cur == -* ]]; then
2469 if [[ $prev == -llfolder ]]; then
2470 COMPREPLY=($(compgen -W "$opts" -- $cur))
2472 COMPREPLY=($(compgen -W "$lopts" -- $cur))
2474 elif [[ $prev == -invob ]]; then
2475 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2476 elif [[ $prev == -view ]]; then
2477 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2478 elif [[ $prev == -in || $cur == * ]]; then
2479 COMPREPLY=($(compgen -W "$(_folders $cur)"))
2483 function _lspool () {
2494 cur="${COMP_WORDS[COMP_CWORD]}"
2495 prev="${COMP_WORDS[COMP_CWORD-1]}"
2497 if [[ $cur == -* ]]; then
2498 COMPREPLY=($(compgen -W "$opts" -- $cur))
2499 elif [[ $prev == -invob ]]; then
2500 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2504 function _lsprivate () {
2519 cur="${COMP_WORDS[COMP_CWORD]}"
2520 prev="${COMP_WORDS[COMP_CWORD-1]}"
2522 if [[ $cur == -* ]]; then
2523 COMPREPLY=($(compgen -W "$opts" -- $cur))
2524 elif [[ $prev == -tag ]]; then
2525 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2526 elif [[ $prev == -invob ]]; then
2527 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2531 function _lsproject () {
2551 cur="${COMP_WORDS[COMP_CWORD]}"
2552 prev="${COMP_WORDS[COMP_CWORD-1]}"
2554 if [[ $cur == -* ]]; then
2555 COMPREPLY=($(compgen -W "$opts" -- $cur))
2556 elif [[ $prev == -view ]]; then
2557 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2558 elif [[ $prev == -invob ]]; then
2559 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2560 elif [[ $prev == -in || $cur == * ]]; then
2561 COMPREPLY=($(compgen -W "$(_folders $cur)"))
2565 function _lsregion () {
2573 cur="${COMP_WORDS[COMP_CWORD]}"
2574 prev="${COMP_WORDS[COMP_CWORD-1]}"
2576 if [[ $cur == -* ]]; then
2577 COMPREPLY=($(compgen -W "$opts" -- $cur))
2578 elif [[ $prev == * ]]; then
2579 regions=$(scm lsregion -short | grep ^$cur)
2580 COMPREPLY=($(compgen -W "$regions" -- $cur))
2584 function _lsstgloc () {
2597 cur="${COMP_WORDS[COMP_CWORD]}"
2598 prev="${COMP_WORDS[COMP_CWORD-1]}"
2600 if [[ $cur == -* ]]; then
2601 COMPREPLY=($(compgen -W "$opts" -- $cur))
2602 elif [[ $prev == -region ]]; then
2603 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
2604 elif [[ $prev == -storage ]]; then
2605 COMPREPLY=($(compgen -W "$(_stglocs $cur)"))
2606 elif [[ $prev == -host ]]; then
2611 function _lsstream () {
2628 local lopts="$opts -long"
2630 cur="${COMP_WORDS[COMP_CWORD]}"
2631 prev="${COMP_WORDS[COMP_CWORD-1]}"
2633 if [[ $cur == -* ]]; then
2634 if [[ $prev == llstream ]]; then
2635 COMPREPLY=($(compgen -W "$opts" -- $cur))
2637 COMPREPLY=($(compgen -W "$lopts" -- $cur))
2639 elif [[ $prev == -in ]]; then
2640 COMPREPLY=($(compgen -W "$(_projects $cur)"))
2641 elif [[ $prev == -invob ]]; then
2642 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2643 elif [[ $prev == -view ]]; then
2644 COMPREPLY=($(compgen -W "$(lsviews)"))
2645 elif [[ $cur == * ]]; then
2646 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2650 function _lstype () {
2666 cur="${COMP_WORDS[COMP_CWORD]}"
2667 prev="${COMP_WORDS[COMP_CWORD-1]}"
2669 if [[ $cur == -* ]]; then
2670 COMPREPLY=($(compgen -W "$opts" -- $cur))
2671 elif [[ $prev == -kind ]]; then
2672 COMPREPLY=($(compgen -W "$_kinds" -- $cur))
2673 elif [[ $prev == -invob ]]; then
2674 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2675 elif [[ $cur == * ]]; then
2680 function _lsview () {
2696 local lopts="$opts -long"
2699 cur="${COMP_WORDS[COMP_CWORD]}"
2700 prev="${COMP_WORDS[COMP_CWORD-1]}"
2702 if [[ $cur == -* ]]; then
2703 if [[ $prev == llview ]]; then
2704 COMPREPLY=($(compgen -W "$opts" -- $cur))
2706 COMPREPLY=($(compgen -W "$lopts" -- $cur))
2708 elif [[ $prev == -region ]]; then
2709 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
2710 elif [[ $prev == -host ]]; then
2711 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
2712 elif [[ $cur == * ]]; then
2713 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2717 function _lsvob () {
2732 cur="${COMP_WORDS[COMP_CWORD]}"
2733 prev="${COMP_WORDS[COMP_CWORD-1]}"
2735 if [[ $cur == -* ]]; then
2736 if [[ $prev == llvob ]]; then
2737 COMPREPLY=($(compgen -W "$opts" -- $cur))
2739 COMPREPLY=($(compgen -W "$lopts" -- $cur))
2741 elif [[ $prev == -region ]]; then
2742 COMPREPLY=($(compgen -W "$(_regions $cur)"))
2743 elif [[ $prev == -host ]]; then
2744 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
2745 elif [[ $cur == * ]]; then
2746 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2750 function _mkactivity () {
2760 cur="${COMP_WORDS[COMP_CWORD]}"
2761 prev="${COMP_WORDS[COMP_CWORD-1]}"
2763 if [[ $cur == -* ]]; then
2764 COMPREPLY=($(compgen -W "$opts" -- $cur))
2765 elif [[ $prev == -in ]]; then
2766 COMPREPLY=($(compgen -W "$(_streams $cur)"))
2788 cur="${COMP_WORDS[COMP_CWORD]}"
2789 prev="${COMP_WORDS[COMP_CWORD-1]}"
2791 if [[ $cur == -* ]]; then
2792 COMPREPLY=($(compgen -W "$opts" -- $cur))
2793 elif [[ $prev == -activities ]]; then
2794 COMPREPLY=($(compgen -W "$(_activities $cur)"))
2795 elif [[ $prev == -component ||
2796 $prev == -adepends_on ||
2797 $prev == -ddepends_on ]]; then
2798 COMPREPLY=($(compgen -W "$(_components $cur)"))
2799 elif [[ $prev == -clone ]]; then
2800 COMPREPLY=($(compgen -W "$(_baselines $cur)"))
2801 elif [[ $prev == -view ]]; then
2802 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2806 function _mkcomp () {
2814 cur="${COMP_WORDS[COMP_CWORD]}"
2815 prev="${COMP_WORDS[COMP_CWORD-1]}"
2817 if [[ $cur == -* ]]; then
2818 COMPREPLY=($(compgen -W "$opts" -- $cur))
2819 elif [[ $cur == * ]]; then
2820 COMPREPLY=($(compgen -W "$(_components $cur)"))
2824 function _mkfolder () {
2831 cur="${COMP_WORDS[COMP_CWORD]}"
2832 prev="${COMP_WORDS[COMP_CWORD-1]}"
2834 if [[ $cur == -* ]]; then
2835 COMPREPLY=($(compgen -W "$opts" -- $cur))
2836 elif [[ $prev == -in ||
2838 COMPREPLY=($(compgen -W "$(_folders $cur)"))
2842 function _mkproject () {
2859 cur="${COMP_WORDS[COMP_CWORD]}"
2860 prev="${COMP_WORDS[COMP_CWORD-1]}"
2862 if [[ $cur == -* ]]; then
2863 COMPREPLY=($(compgen -W "$opts" -- $cur))
2864 elif [[ $prev == -modcomp ]]; then
2865 COMPREPLY=($(compgen -W "$(_components $cur)"))
2866 elif [[ $prev == -in ]]; then
2867 COMPREPLY=($(compgen -W "$(_folders $cur)"))
2868 elif [[ $prev == -policy ||
2869 $prev == -npolicy ||
2870 $prev == -spolicy ]]; then
2871 COMPREPLY=($(compgen -W "$_policies" -- $cur))
2875 function _mkregion () {
2884 cur="${COMP_WORDS[COMP_CWORD]}"
2885 prev="${COMP_WORDS[COMP_CWORD-1]}"
2887 if [[ $cur == -* ]]; then
2888 COMPREPLY=($(compgen -W "$opts" -- $cur))
2889 elif [[ $prev == -tag ]]; then
2890 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
2894 function _mkstgloc () {
2909 cur="${COMP_WORDS[COMP_CWORD]}"
2910 prev="${COMP_WORDS[COMP_CWORD-1]}"
2912 if [[ $cur == -* ]]; then
2913 COMPREPLY=($(compgen -W "$opts" -- $cur))
2914 elif [[ $prev == -region ]]; then
2915 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
2916 elif [[ $prev == -host ]]; then
2917 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
2921 function _mkstream () {
2937 cur="${COMP_WORDS[COMP_CWORD]}"
2938 prev="${COMP_WORDS[COMP_CWORD-1]}"
2940 if [[ $cur == -* ]]; then
2941 COMPREPLY=($(compgen -W "$opts" -- $cur))
2942 elif [[ $prev == -amodcomp ]]; then
2943 COMPREPLY=($(compgen -W "$(_components $cur)"))
2944 elif [[ $prev == -baseline ]]; then
2945 COMPREPLY=($(compgen -W "$(_baselines $cur)"))
2946 elif [[ $prev == -in ]]; then
2947 COMPREPLY=($(compgen -W "$(_projects $cur)"))
2948 elif [[ $prev == -policy ||
2949 $prev == -npolicy ]]; then
2950 COMPREPLY=($(compgen -W "$(_policies $cur)" -- $cur))
2954 function _mktag () {
2972 cur="${COMP_WORDS[COMP_CWORD]}"
2973 prev="${COMP_WORDS[COMP_CWORD-1]}"
2974 prev2="$(COMP_WORDS[COMP_CWORD-2])"
2976 if [[ $cur == -* ]]; then
2977 COMPREPLY=($(compgen -W "$opts" -- $cur))
2978 elif [[ $prev2 == -view && $prev == "-tag" ]]; then
2979 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
2980 elif [[ $prev2 == -vob && $prev == "-tag" ]]; then
2981 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
2982 elif [[ $prev == -region ]]; then
2983 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
2984 elif [[ $prev == -host ]]; then
2985 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
2989 function _mktrtype () {
3020 cur="${COMP_WORDS[COMP_CWORD]}"
3021 prev="${COMP_WORDS[COMP_CWORD-1]}"
3023 if [[ $cur == -* ]]; then
3024 COMPREPLY=($(compgen -W "$opts" -- $cur))
3025 elif [[ $prev == -preop ||
3026 $prev == -postopt ]]; then
3027 COMPREPLY=($(compgen -W "$_operation_types" -- $cur))
3028 elif [[ $prev == -project ]]; then
3029 COMPREPLY=($(compgen -W "$(_projects $cur)"))
3030 elif [[ $prev == -stream ]]; then
3031 COMPREPLY=($(compgen -W "$(_streams $cur)"))
3032 elif [[ $prev == -component ]]; then
3033 COMPREPLY=($(compgen -W "$(_components $cur)"))
3034 elif [[ $prev == -folder ]]; then
3035 COMPREPLY=($(compgen -W "$(_folders $cur)"))
3036 elif [[ $prev == -activity ]]; then
3037 COMPREPLY=($(compgen -W "$(_activites $cur)" -- $cur))
3038 elif [[ $prev == -baseline ]]; then
3039 COMPREPLY=($(compgen -W "$(_baselines $cur)"))
3040 elif [[ $prev == -attype ]]; then
3041 COMPREPLY=($(compgen -W "$(_attypes $cur)"))
3042 elif [[ $prev == -brtype ]]; then
3043 COMPREPLY=($(compgen -W "$(_brtypes $cur)"))
3044 elif [[ $prev == -eltype ]]; then
3045 COMPREPLY=($(compgen -W "$(_eltypes $cur)"))
3046 elif [[ $prev == -hltype ]]; then
3047 COMPREPLY=($(compgen -W "$(_hltypes $cur)"))
3048 elif [[ $prev == -lbtype ]]; then
3049 COMPREPLY=($(compgen -W "$(_lbtypes $cur)"))
3050 elif [[ $prev == -trtypes ]]; then
3051 COMPREPLY=($(compgen -W "$(_trtypes $cur)"))
3055 function _mkview () {
3078 cur="${COMP_WORDS[COMP_CWORD]}"
3079 prev="${COMP_WORDS[COMP_CWORD-1]}"
3081 if [[ $cur == -* ]]; then
3082 COMPREPLY=($(compgen -W "$opts" -- $cur))
3083 elif [[ $prev == -tag ]]; then
3084 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3085 elif [[ $prev == -region ]]; then
3086 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
3087 elif [[ $prev == -stgloc ]]; then
3088 COMPREPLY=($(compgen -W "$(_stglocs $cur)"))
3089 elif [[ $prev == -host ]]; then
3090 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
3094 function _mkvob () {
3114 cur="${COMP_WORDS[COMP_CWORD]}"
3115 prev="${COMP_WORDS[COMP_CWORD-1]}"
3117 if [[ $cur == -* ]]; then
3118 COMPREPLY=($(compgen -W "$opts" -- $cur))
3119 elif [[ $prev == -tag ]]; then
3120 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3121 elif [[ $prev == -region ]]; then
3122 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
3123 elif [[ $prev == -stgloc ]]; then
3124 COMPREPLY=($(compgen -W "$(_stglocs $cur)"))
3125 elif [[ $prev == -host ]]; then
3126 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
3130 function _mount () {
3139 cur="${COMP_WORDS[COMP_CWORD]}"
3140 prev="${COMP_WORDS[COMP_CWORD-1]}"
3142 if [[ $cur == -* ]]; then
3143 COMPREPLY=($(compgen -W "$opts" -- $cur))
3144 elif [[ $cur == * ]]; then
3145 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3149 function _rebase () {
3176 cur="${COMP_WORDS[COMP_CWORD]}"
3177 prev="${COMP_WORDS[COMP_CWORD-1]}"
3179 if [[ $cur == -* ]]; then
3180 COMPREPLY=($(compgen -W "$opts" -- $cur))
3181 elif [[ $prev == -view ]]; then
3182 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3183 elif [[ $prev == -stream ]]; then
3184 COMPREPLY=($(compgen -W "$(_streams $cur)"))
3185 elif [[ $prev == -baseline ||
3186 $prev == -dbaseline ]]; then
3187 COMPREPLY=($(compgen -W "$(_baselines $cur)"))
3191 function _recoverview () {
3202 cur="${COMP_WORDS[COMP_CWORD]}"
3203 prev="${COMP_WORDS[COMP_CWORD-1]}"
3205 if [[ $cur == -* ]]; then
3206 COMPREPLY=($(compgen -W "$opts" -- $cur))
3207 elif [[ $prev == -tag ]]; then
3208 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3209 elif [[ $prev == -vob ]]; then
3210 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3214 function _reformatview () {
3223 cur="${COMP_WORDS[COMP_CWORD]}"
3224 prev="${COMP_WORDS[COMP_CWORD-1]}"
3226 if [[ $cur == -* ]]; then
3227 COMPREPLY=($(compgen -W "$opts" -- $cur))
3228 elif [[ $prev == -tag ]]; then
3229 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3233 function _reformatvob () {
3245 cur="${COMP_WORDS[COMP_CWORD]}"
3246 prev="${COMP_WORDS[COMP_CWORD-1]}"
3248 if [[ $cur == -* ]]; then
3249 COMPREPLY=($(compgen -W "$opts" -- $cur))
3250 elif [[ $prev == -host ]]; then
3251 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
3255 function _register () {
3267 cur="${COMP_WORDS[COMP_CWORD]}"
3268 prev="${COMP_WORDS[COMP_CWORD-1]}"
3270 if [[ $cur == -* ]]; then
3271 COMPREPLY=($(compgen -W "$opts" -- $cur))
3272 elif [[ $prev == -host ]]; then
3273 COMPREPLY=($(compgen -W "$(_cchosts $cur)"))
3277 function _rmactivity () {
3285 cur="${COMP_WORDS[COMP_CWORD]}"
3286 prev="${COMP_WORDS[COMP_CWORD-1]}"
3288 if [[ $cur == -* ]]; then
3289 COMPREPLY=($(compgen -W "$opts" -- $cur))
3290 elif [[ $cur == * ]]; then
3291 COMPREPLY=($(compgen -W "$(_activities $cur)"))
3295 function _rmattr () {
3304 cur="${COMP_WORDS[COMP_CWORD]}"
3305 prev="${COMP_WORDS[COMP_CWORD-1]}"
3307 if [[ $cur == -* ]]; then
3308 COMPREPLY=($(compgen -W "$opts" -- $cur))
3309 elif [[ $cur == * ]]; then
3310 COMPREPLY=($(compgen -W "$(_attypes $cur)"))
3322 cur="${COMP_WORDS[COMP_CWORD]}"
3323 prev="${COMP_WORDS[COMP_CWORD-1]}"
3325 if [[ $cur == -* ]]; then
3326 COMPREPLY=($(compgen -W "$opts" -- $cur))
3327 elif [[ $cur == * ]]; then
3328 COMPREPLY=($(compgen -W "$(_baselines $cur)"))
3332 function _rmcomp () {
3340 cur="${COMP_WORDS[COMP_CWORD]}"
3341 prev="${COMP_WORDS[COMP_CWORD-1]}"
3343 if [[ $cur == -* ]]; then
3344 COMPREPLY=($(compgen -W "$opts" -- $cur))
3345 elif [[ $cur == * ]]; then
3346 COMPREPLY=($(compgen -W "$(_components $cur)"))
3350 function _rmfolder () {
3358 cur="${COMP_WORDS[COMP_CWORD]}"
3359 prev="${COMP_WORDS[COMP_CWORD-1]}"
3361 if [[ $cur == -* ]]; then
3362 COMPREPLY=($(compgen -W "$opts" -- $cur))
3363 elif [[ $cur == * ]]; then
3364 COMPREPLY=($(compgen -W "$(_folders $cur)"))
3368 function _rmhlink () {
3375 cur="${COMP_WORDS[COMP_CWORD]}"
3376 prev="${COMP_WORDS[COMP_CWORD-1]}"
3378 if [[ $cur == -* ]]; then
3379 COMPREPLY=($(compgen -W "$opts" -- $cur))
3380 elif [[ $cur == * ]]; then
3381 COMPREPLY=($(compgen -W "$(_hltypes $cur)"))
3385 function _rmlabel () {
3395 cur="${COMP_WORDS[COMP_CWORD]}"
3396 prev="${COMP_WORDS[COMP_CWORD-1]}"
3398 if [[ $cur == -* ]]; then
3399 COMPREPLY=($(compgen -W "$opts" -- $cur))
3400 elif [[ $cur == * ]]; then
3401 COMPREPLY=($(compgen -W "$(_lbtypes $cur)"))
3405 function _rmproject () {
3414 cur="${COMP_WORDS[COMP_CWORD]}"
3415 prev="${COMP_WORDS[COMP_CWORD-1]}"
3417 if [[ $cur == -* ]]; then
3418 COMPREPLY=($(compgen -W "$opts" -- $cur))
3419 elif [[ $cur == * ]]; then
3420 COMPREPLY=($(compgen -W "$(_projects $cur)"))
3424 function _rmregion () {
3433 cur="${COMP_WORDS[COMP_CWORD]}"
3434 prev="${COMP_WORDS[COMP_CWORD-1]}"
3436 if [[ $cur == -* ]]; then
3437 COMPREPLY=($(compgen -W "$opts" -- $cur))
3438 elif [[ $prev == -tag ]]; then
3439 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
3443 function _rmstgloc () {
3452 cur="${COMP_WORDS[COMP_CWORD]}"
3453 prev="${COMP_WORDS[COMP_CWORD-1]}"
3455 if [[ $cur == -* ]]; then
3456 COMPREPLY=($(compgen -W "$opts" -- $cur))
3457 elif [[ $prev == -region ]]; then
3458 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
3459 elif [[ $cur == * ]]; then
3460 COMPREPLY=($(compgen -W "$(_stglocs $cur)"))
3464 function _rmstream () {
3473 cur="${COMP_WORDS[COMP_CWORD]}"
3474 prev="${COMP_WORDS[COMP_CWORD-1]}"
3476 if [[ $cur == -* ]]; then
3477 COMPREPLY=($(compgen -W "$opts" -- $cur))
3478 elif [[ $cur == * ]]; then
3479 COMPREPLY=($(compgen -W "$(_streams $cur)"))
3483 function _rmtag () {
3494 cur="${COMP_WORDS[COMP_CWORD]}"
3495 prev="${COMP_WORDS[COMP_CWORD-1]}"
3497 if [[ $cur == -* ]]; then
3498 COMPREPLY=($(compgen -W "$opts" -- $cur))
3499 elif [[ $prev == -view ]]; then
3500 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3501 elif [[ $prev == -vob ]]; then
3502 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3503 elif [[ $prev == -region ]]; then
3504 COMPREPLY=($(compgen -W "$(_regions $cur)" -- $cur))
3508 function _rmtrigger () {
3518 cur="${COMP_WORDS[COMP_CWORD]}"
3519 prev="${COMP_WORDS[COMP_CWORD-1]}"
3521 if [[ $cur == -* ]]; then
3522 COMPREPLY=($(compgen -W "$opts" -- $cur))
3523 elif [[ $cur == * ]]; then
3524 COMPREPLY=($(compgen -W "$(_trtypes $cur)"))
3528 function _rmtype () {
3538 cur="${COMP_WORDS[COMP_CWORD]}"
3539 prev="${COMP_WORDS[COMP_CWORD-1]}"
3541 if [[ $cur == -* ]]; then
3542 COMPREPLY=($(compgen -W "$opts" -- $cur))
3543 elif [[ $cur == * ]]; then
3548 function _rmview () {
3560 cur="${COMP_WORDS[COMP_CWORD]}"
3561 prev="${COMP_WORDS[COMP_CWORD-1]}"
3563 if [[ $cur == -* ]]; then
3564 COMPREPLY=($(compgen -W "$opts" -- $cur))
3565 elif [[ $prev == -tag ]]; then
3566 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3567 elif [[ $prev == -vob ]]; then
3568 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3572 function _rmvob () {
3579 cur="${COMP_WORDS[COMP_CWORD]}"
3580 prev="${COMP_WORDS[COMP_CWORD-1]}"
3582 if [[ $cur == -* ]]; then
3583 COMPREPLY=($(compgen -W "$opts" -- $cur))
3584 elif [[ $cur == * ]]; then
3585 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3589 function _setcs () {
3605 cur="${COMP_WORDS[COMP_CWORD]}"
3606 prev="${COMP_WORDS[COMP_CWORD-1]}"
3608 if [[ $cur == -* ]]; then
3609 COMPREPLY=($(compgen -W "$opts" -- $cur))
3610 elif [[ $cur == -tag ]]; then
3611 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3615 function _setplevel () {
3624 cur="${COMP_WORDS[COMP_CWORD]}"
3625 prev="${COMP_WORDS[COMP_CWORD-1]}"
3627 if [[ $cur == -* ]]; then
3628 COMPREPLY=($(compgen -W "$opts" -- $cur))
3629 elif [[ $prev == -invob ]]; then
3630 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3634 function _setview() {
3642 cur="${COMP_WORDS[COMP_CWORD]}"
3643 prev="${COMP_WORDS[COMP_CWORD-1]}"
3645 if [[ $cur == -* && $ARCHITECTURE != cygwin ]]; then
3646 COMPREPLY=($(compgen -W "$opts" -- $cur))
3647 elif [[ $cur == * ]]; then
3648 COMPREPLY=($(compgen -W "$(_views $cur)"))
3652 function _space () {
3667 cur="${COMP_WORDS[COMP_CWORD]}"
3668 prev="${COMP_WORDS[COMP_CWORD-1]}"
3670 if [[ $cur == -* ]]; then
3671 COMPREPLY=($(compgen -W "$opts" -- $cur))
3672 elif [[ $prev == -view ]]; then
3673 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3674 elif [[ $prev == -vob || $cur == * ]]; then
3675 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3679 function _startview () {
3685 cur="${COMP_WORDS[COMP_CWORD]}"
3686 prev="${COMP_WORDS[COMP_CWORD-1]}"
3688 if [[ $cur == -* ]]; then
3689 COMPREPLY=($(compgen -W "$opts" -- $cur))
3690 elif [[ $cur == * ]]; then
3691 COMPREPLY=($(compgen -W "$(lsviews)" -- $cur))
3695 function _umount () {
3702 cur="${COMP_WORDS[COMP_CWORD]}"
3703 prev="${COMP_WORDS[COMP_CWORD-1]}"
3705 if [[ $cur == -* ]]; then
3706 COMPREPLY=($(compgen -W "$opts" -- $cur))
3707 elif [[ $cur == * ]]; then
3708 COMPREPLY=($(compgen -W "$(_vobs $cur)"))
3712 function _unlock () {
3721 cur="${COMP_WORDS[COMP_CWORD]}"
3722 prev="${COMP_WORDS[COMP_CWORD-1]}"
3724 if [[ $cur == -* ]]; then
3725 COMPREPLY=($(compgen -W "$opts" -- $cur))
3726 elif [[ $cur == * ]]; then
3727 COMPREPLY=($(compgen -W "$(_object_selector $cur)" -- $cur))
3735 cur="${COMP_WORDS[COMP_CWORD]}"
3736 cmd="${COMP_WORDS[0]}"
3737 subcmd="${COMP_WORDS[1]}"
3739 if [[ $cmd == scm || $cmd == ct ]]; then
3740 if [[ $COMP_CWORD == 1 ]]; then
3741 COMPREPLY=($(compgen -W "$_scm_cmds" -- $cur))
3745 COMPREPLY=($(compgen -W "$_annotate_opts" -- $cur));;
3747 COMPREPLY=($(compgen -W "$_catcr_opts" -- $cur));;
3753 COMPREPLY=($(compgen -W "$_chbl_opts" -- $cur));;
3757 COMPREPLY=($(compgen -W "$_checkout_opts" -- $cur));;
3763 COMPREPLY=($(compgen -W "$_chflevel_opts" -- $cur));;
3769 COMPREPLY=($(compgen -W "$_chpool_opts" -- $cur));;
3775 COMPREPLY=($(compgen -W "$_chtype_opts" -- $cur));;
3783 COMPREPLY=($(compgen -W "$_diff_opts" -- $cur));;
3785 COMPREPLY=($(compgen -W "$_diffbl_opts" -- $cur));;
3787 COMPREPLY=($(compgen -W "$_diffcr_opts" -- $cur));;
3797 COMPREPLY=($(compgen -W "$_find_opts" -- $cur));;
3799 COMPREPLY=($(compgen -W "$_findmerge_opts" -- $cur));;
3801 COMPREPLY=($(compgen -W "$_get_opts" -- $cur));;
3803 COMPREPLY=($(compgen -W "$_getcache_opts" -- $cur));;
3807 COMPREPLY=($(compgen -W "$_scm_cmds" -- $cur));;
3811 COMPREPLY=($(compgen -W "$_ln_opts" -- $cur));;
3813 COMPREPLY=($(compgen -W "$_ls_opts" -- $cur));;
3819 COMPREPLY=($(compgen -W "$_lscheckout_opts" -- $cur));;
3825 COMPREPLY=($(compgen -W "$_lsdo_opts" -- $cur));;
3829 COMPREPLY=($(compgen -W "$_lshistory_opts" -- $cur));;
3831 COMPREPLY=($(compgen -W "$_lslock_opts" -- $cur));;
3833 COMPREPLY=($(compgen -W "$_lsmaster_opts" -- $cur));;
3843 COMPREPLY=($(compgen -W "$_lsreplica_opts" -- $cur));;
3845 COMPREPLY=($(compgen -W "$_lssite_opts" -- $cur));;
3857 COMPREPLY=($(compgen -W "$_lsvtree_opts" -- $cur));;
3859 COMPREPLY=($(compgen -W "$_scm_cmds" -- $cur));;
3861 COMPREPLY=($(compgen -W "$_merge_opts" -- $cur));;
3865 COMPREPLY=($(compgen -W "$_mkattr_opts" -- $cur));;
3867 COMPREPLY=($(compgen -W "$_mkattype_opts" -- $cur));;
3871 COMPREPLY=($(compgen -W "$_mkbranch_opts" -- $cur));;
3873 COMPREPLY=($(compgen -W "$_mkbrtype_opts" -- $cur));;
3877 COMPREPLY=($(compgen -W "$_mkdir_opts" -- $cur));;
3879 COMPREPLY=($(compgen -W "$_mkelem_opts" -- $cur));;
3881 COMPREPLY=($(compgen -W "$_mkeltype_opts" -- $cur));;
3885 COMPREPLY=($(compgen -W "$_mkhlink_opts" -- $cur));;
3887 COMPREPLY=($(compgen -W "$_mkhltype_opts" -- $cur));;
3889 COMPREPLY=($(compgen -W "$_mklabel_opts" -- $cur));;
3891 COMPREPLY=($(compgen -W "$_mklbtype_opts" -- $cur));;
3893 COMPREPLY=($(compgen -W "$_mkpool_opts" -- $cur));;
3905 COMPREPLY=($(compgen -W "$_mktrigger_opts" -- $cur));;
3915 COMPREPLY=($(compgen -W "$_move_opts" -- $cur));;
3917 COMPREPLY=($(compgen -W "$_protect_opts" -- $cur));;
3919 COMPREPLY=($(compgen -W "$_protectvob_opts" -- $cur));;
3921 COMPREPLY=($(compgen -W "$_pwd_opts" -- $cur));;
3923 COMPREPLY=($(compgen -W "$_pwv_opts" -- $cur));;
3935 COMPREPLY=($(compgen -W "$_relocate_opts" -- $cur));;
3937 COMPREPLY=($(compgen -W "$_rename_opts" -- $cur));;
3939 COMPREPLY=($(compgen -W "$_reqmaster_opts" -- $cur));;
3941 COMPREPLY=($(compgen -W "$_reserve_opts" -- $cur));;
3949 COMPREPLY=($(compgen -W "$_rmbranch_opts" -- $cur));;
3953 COMPREPLY=($(compgen -W "$_rmdo_opts" -- $cur));;
3955 COMPREPLY=($(compgen -W "$_rmelem_opts" -- $cur));;
3963 COMPREPLY=($(compgen -W "$_rmmerge_opts" -- $cur));;
3965 COMPREPLY=($(compgen -W "$_rmname_opts" -- $cur));;
3967 COMPREPLY=($(compgen -W "$_rmpool_opts" -- $cur));;
3983 COMPREPLY=($(compgen -W "$_rmver_opts" -- $cur));;
3989 COMPREPLY=($(compgen -W "$_schedule_opts" -- $cur));;
3991 COMPREPLY=($(compgen -W "$_setcache_opts" -- $cur));;
3999 COMPREPLY=($(compgen -W "$_setsite_opts" -- $cur));;
4007 COMPREPLY=($(compgen -W "$_uncheckout_opts" -- $cur));;
4011 COMPREPLY=($(compgen -W "$_unregister_opts" -- $cur));;
4013 COMPREPLY=($(compgen -W "$_unreserve_opts" -- $cur));;
4015 COMPREPLY=($(compgen -W "$_update_opts" -- $cur));;
4017 COMPREPLY=($(compgen -W "$_winkin_opts" -- $cur));;
4023 # TODO: These functions aren't working very well yet.
4024 function _type_selector () {
4025 local cur prev prev2
4027 cur="${COMP_WORDS[COMP_CWORD]}"
4029 if (($COMP_CWORD - 1 >= 0)); then
4030 prev="${COMP_WORDS[COMP_CWORD-1]}"
4033 if (($COMP_CWORD - 2 >= 0)); then
4034 prev2="${COMP_WORDS[COMP_CWORD-2]}"
4037 if [[ $prev == : ]]; then
4038 COMPREPLY=($(compgen -W "$(ct lstype -kind $prev2 -short -invob $dvob | grep ^$cur)" -- $cur))
4039 elif [[ $cur == : ]]; then
4040 COMPREPLY=($(compgen -W "$(ct lstype -kind $prev -short -invob $dvob)"))
4041 elif [[ $cur == * ]]; then
4042 COMPREPLY=($(compgen -W "$_type_selectors" -- $cur))
4046 function _object_selector () {
4047 local cur prev prev2
4051 cur="${COMP_WORDS[COMP_CWORD]}"
4053 if (($COMP_CWORD - 1 >= 0)); then
4054 prev="${COMP_WORDS[COMP_CWORD-1]}"
4057 if (($COMP_CWORD - 2 >= 0)); then
4058 prev2="${COMP_WORDS[COMP_CWORD-2]}"
4061 if [[ $prev == activity || ($prev == : && $prev2 == activity) ]]; then
4062 if [[ $cur == : ]]; then
4063 COMPREPLY=($(compgen -W "$(_activities)" -- ""))
4066 COMPREPLY=($(compgen -W "$(_activities $cur)"))
4067 echo "COMPREPLY = ${COMPREPLY[*]}"
4069 elif [[ $prev == lbtype || ($prev == : && $prev2 == lbtype) ]]; then
4070 if [[ $cur == : ]]; then
4071 COMPREPLY=($(compgen -W "$(_lbtypes)" -- ""))
4072 echo "COMPREPLY = ${COMPREPLY[*]}"
4075 COMPREPLY=($(compgen -W "$(_lbtypes $cur)"))
4076 echo "COMPREPLY = ${COMPREPLY[*]}"
4078 elif [[ $cur == * ]] ; then
4079 COMPREPLY=($(compgen -W "$_object_selectors" -- $cur))
4081 } # _object_selector
4083 if [[ $BASH_VERSION = 2.05* || $BASH_VERSION = 4* ]]; then
4084 complete -o default -F _scm scm ct
4086 complete -F _catcs catcs
4087 complete -F _checkin ci
4088 complete -F _deliver deliver
4089 complete -F _endview endview
4090 complete -F _lsactivity lsact
4091 complete -F _lsbl lsbl
4092 complete -F _lsproject lsproj
4093 complete -F _lsfolder lsfolder llfolder
4094 complete -F _lsstgloc lsstgloc
4095 complete -F _lsstream lsstream llstream
4096 complete -F _lsview lsview llview
4097 complete -F _lsvob lsvob llvob
4098 complete -F _merge merge
4099 complete -F _mktag mktag
4100 complete -F _mkview mkview
4101 complete -F _rebase rebase
4102 complete -F _rmtag rmtag
4103 complete -F _rmview rmview
4104 complete -F _setactivity setact
4105 complete -F _setcs setcs
4106 complete -F _setview setview
4107 complete -F _startview startview
4108 complete -F _space space
4109 complete -F _register register
4110 complete -F _uncheckout unco
4111 complete -F _unregister unregister
4113 : echo 'Clearcase command completion broken on old Sun Bash shells'
4116 if [[ $BASH_VERSION = 4* ]]; then
4117 complete -F _object_selector -o nospace lstype
4118 complete -F _object_selector -o nospace lltype
4119 complete -F _object_selector -o nospace lslock
4120 complete -F _object_selector -o nospace lllock
4121 elif [[ $BASH_VERSION = 2.05* ]]; then
4122 complete -F _object_selector lstype
4123 complete -F _object_selector lltype
4124 complete -F _object_selector lslock
4125 complete -F _object_selector lllock
4126 #echo 'Clearcase command completion partially broken on old Sun Bash shells'