From 93119f0b59d78ba98337b489fcbad9dcdecb0d7d Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sat, 3 Dec 2022 13:25:39 +0200
Subject: [PATCH] Add basic pre-commit bash completion.

---
 bash_completion.d/pre-commit | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 bash_completion.d/pre-commit

diff --git a/bash_completion.d/pre-commit b/bash_completion.d/pre-commit
new file mode 100644
index 0000000..efae4b4
--- /dev/null
+++ b/bash_completion.d/pre-commit
@@ -0,0 +1,17 @@
+# vim: ft=bash
+
+_pre_commit () {
+    local cur prev words cword opts
+    _init_completion || return
+    opts='-h --help -V --version'
+    commands='autoupdate clean gc init-templatedir install install-hooks migrate-config run sample-config try-repo uninstall validate-config validate-manifest help hook-impl'
+
+    if [[ $cur == -* ]]
+    then
+        COMPREPLY=($(compgen -W "$opts" -- "$cur"))
+    else
+        COMPREPLY=($(compgen -W "$commands" -- "$cur"))
+    fi
+}
+
+complete -F _pre_commit pre-commit
-- 
GitLab