WebKitTools/Scripts/webkit-tools-completion.sh
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     1 # Copyright (C) 2009 Google Inc. All rights reserved.
       
     2 #
       
     3 # Redistribution and use in source and binary forms, with or without
       
     4 # modification, are permitted provided that the following conditions are
       
     5 # met:
       
     6 #
       
     7 #     * Redistributions of source code must retain the above copyright
       
     8 # notice, this list of conditions and the following disclaimer.
       
     9 #     * Redistributions in binary form must reproduce the above
       
    10 # copyright notice, this list of conditions and the following disclaimer
       
    11 # in the documentation and/or other materials provided with the
       
    12 # distribution.
       
    13 #     * Neither the name of Google Inc. nor the names of its
       
    14 # contributors may be used to endorse or promote products derived from
       
    15 # this software without specific prior written permission.
       
    16 #
       
    17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
       
    18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
       
    19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
       
    20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
       
    21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
       
    22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
       
    23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
       
    24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
       
    25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
       
    26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
       
    27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    28 #
       
    29 # Command line completion for common commands used in WebKit development.
       
    30 #
       
    31 # Set-up:
       
    32 #   Add a line like this to your .bashrc:
       
    33 #     source /path/to/WebKitCode/WebKitTools/Scripts/webkit-tools-completion.sh
       
    34 
       
    35 __webkit-patch_generate_reply()
       
    36 {
       
    37     COMPREPLY=( $(compgen -W "$1" -- "${COMP_WORDS[COMP_CWORD]}") )
       
    38 }
       
    39 
       
    40 _webkit-patch_complete()
       
    41 {
       
    42     local command current_command="${COMP_WORDS[1]}"
       
    43     case "$current_command" in
       
    44         -h|--help)
       
    45             command="help";
       
    46             ;;
       
    47         *)
       
    48             command="$current_command"
       
    49             ;;
       
    50     esac
       
    51 
       
    52     if [ $COMP_CWORD -eq 1 ]; then
       
    53         __webkit-patch_generate_reply "--help apply-from-bug bugs-to-commit commit-message land land-from-bug obsolete-attachments patches-to-commit post upload tree-status rollout reviewed-patches"
       
    54         return
       
    55     fi
       
    56 
       
    57     case "$command" in
       
    58         apply-from-bug)
       
    59             __webkit-patch_generate_reply "--force-clean --local-commit --no-clean --no-update"
       
    60             return
       
    61             ;;
       
    62         commit-message)
       
    63             return
       
    64             ;;
       
    65         land)
       
    66             __webkit-patch_generate_reply "--no-build --no-close --no-test --reviewer= -r"
       
    67             return
       
    68             ;;
       
    69         land-from-bug)
       
    70             __webkit-patch_generate_reply "--force-clean --no-build --no-clean --no-test"
       
    71             return
       
    72             ;;
       
    73         obsolete-attachments)
       
    74             return
       
    75             ;;
       
    76         post)
       
    77             __webkit-patch_generate_reply "--description --no-obsolete --no-review --request-commit -m --open-bug"
       
    78             return
       
    79             ;;
       
    80         upload)
       
    81             __webkit-patch_generate_reply "--description --no-obsolete --no-review --request-commit --cc -m --open-bug"
       
    82             return
       
    83             ;;
       
    84         post-commits)
       
    85             __webkit-patch_generate_reply "--bug-id= --no-comment --no-obsolete --no-review -b"
       
    86             return
       
    87             ;;
       
    88     esac
       
    89 }
       
    90 
       
    91 complete -F _webkit-patch_complete webkit-patch
       
    92 complete -W "--continue --fix-merged --help --no-continue --no-warnings --warnings -c -f -h -w" resolve-ChangeLogs
       
    93 complete -W "--bug --diff --git-commit --git-index --git-reviewer --help --no-update --no-write --open --update --write -d -h -o" prepare-ChangeLog
       
    94 complete -W "--clean --debug --help -h" build-webkit
       
    95 complete -o default -W "--add-platform-exceptions --complex-text --configuration --guard-malloc --help --http --ignore-tests --launch-safari --leaks --merge-leak-depth --new-test-results --no-http --no-launch-safari --no-new-test-results --no-sample-on-timeout --no-strip-editing-callbacks --pixel-tests --platform --port --quiet --random --reset-results --results-directory --reverse --root --sample-on-timeout --singly --skipped --slowest --strict --strip-editing-callbacks --threaded --timeout --tolerance --use-remote-links-to-tests --valgrind --verbose -1 -c -g -h -i -l -m -o -p -q -t -v" run-webkit-tests