blob: 19060a5c17208659e1e596f33db93e07ce9ced85 [file] [log] [blame]
David Pursehouse3c082432013-08-22 15:28:49 +09001# The MIT License
2#
3# Copyright (C) 2013 Sony Mobile Communications. All rights reserved.
4#
5# Permission is hereby granted, free of charge, to any person obtaining a copy
6# of this software and associated documentation files (the "Software"), to deal
7# in the Software without restriction, including without limitation the rights
8# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9# copies of the Software, and to permit persons to whom the Software is
10# furnished to do so, subject to the following conditions:
11#
12# The above copyright notice and this permission notice shall be included in
13# all copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21# THE SOFTWARE.
22#
23# #########################################################################
24# This bash script adds tab-completion to the gerrit.sh script.
25#
26# Testing it out without installing
27# =================================
28#
29# To test out the completion without "installing" this, just run this file
30# directly, like so:
31#
32# . ~/path/to/bash_completion
33#
34# Note: There's a dot ('.') at the beginning of that command.
35#
36# After you do that, tab completion will immediately be made available in your
37# current Bash shell. It will not, however, be available next time you log in.
38#
39# Installing
40# ==========
41#
David Pursehouse9d62c202013-09-27 10:18:30 +090042# To install the completion, copy this file to the appropriate folder for
43# your distribution, for example:
44#
45# cp ~/path/to/bash_completion /etc/bash_completion.d/gerrit_sh
46#
47# Alternatively you can invoke this file from your .bash_profile, like so:
David Pursehouse3c082432013-08-22 15:28:49 +090048#
49# . ~/path/to/bash_completion
50#
51# Do the same in your .bashrc if .bashrc doesn't invoke .bash_profile.
52#
53# The settings will take effect the next time you log in.
54#
55# Uninstalling
56# ============
57#
David Pursehouse9d62c202013-09-27 10:18:30 +090058# To uninstall, just remove the file from the bash completion folder, or
59# remove the line from your .bash_profile and .bashrc.
David Pursehouse3c082432013-08-22 15:28:49 +090060# #########################################################################
61
62_gerrit_sh()
63{
64 local cur prev opts
65 COMPREPLY=()
66 cur="${COMP_WORDS[COMP_CWORD]}"
67 prev="${COMP_WORDS[COMP_CWORD-1]}"
Richard Fearn626327c2016-03-23 17:04:56 +000068 opts="check restart run start status stop supervise threads"
David Pursehouse3c082432013-08-22 15:28:49 +090069
70 COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
71}
72complete -F _gerrit_sh gerrit.sh
73