Index: tools/bash-completion |
diff --git a/tools/bash-completion b/tools/bash-completion |
new file mode 100644 |
index 0000000000000000000000000000000000000000..760954f187c4a81d504fe28d462716e9619f98f3 |
--- /dev/null |
+++ b/tools/bash-completion |
@@ -0,0 +1,22 @@ |
+# 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' | \ |
enne (OOO)
2012/02/03 20:23:41
Two quick suggestions:
(1) It looks like there's
|
+ grep -v /) |
+ COMPREPLY=($(compgen -W "$targets" -- "$cur")) |
+ return 0 |
+} |
+ |
+complete -F _chrome_flag google-chrome |
+complete -F _chrome_flag chrome |