diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-03 21:44:54 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-03 21:44:54 +0000 |
commit | 37e2a80818f55b47dc9b58cb52c7c08f0bf9b166 (patch) | |
tree | 8f68d56abd39a69dc18deec427423b0427204245 /tools/bash-completion | |
parent | 42dc3d8a435af5f549f6f5596a2105454622b113 (diff) | |
download | chromium_src-37e2a80818f55b47dc9b58cb52c7c08f0bf9b166.zip chromium_src-37e2a80818f55b47dc9b58cb52c7c08f0bf9b166.tar.gz chromium_src-37e2a80818f55b47dc9b58cb52c7c08f0bf9b166.tar.bz2 |
bash completion rules
You can source this file from bash to add tab-completion of command-line
flags.
Review URL: https://chromiumcodereview.appspot.com/9320075
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120403 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/bash-completion')
-rw-r--r-- | tools/bash-completion | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/bash-completion b/tools/bash-completion new file mode 100644 index 0000000..229582c --- /dev/null +++ b/tools/bash-completion @@ -0,0 +1,21 @@ +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Flag completion rule for bash. +# To load in your shell, "source path/to/this/file". + +chrome_source=$(readlink -f $(dirname $BASH_SOURCE)/..) + +_chrome_flag() { + local cur targets + cur="${COMP_WORDS[COMP_CWORD]}" + targets=$(cd $chrome_source; \ + git ls-files | grep switches | \ + xargs sed -ne 's/^[^/]*"\([^" /]\+\)".*/--\1/p') + COMPREPLY=($(compgen -W "$targets" -- "$cur")) + return 0 +} + +complete -F _chrome_flag google-chrome +complete -F _chrome_flag chrome |