summaryrefslogtreecommitdiffstats
path: root/.config/zsh/oh-my-zsh/plugins/fossil/_fossil
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2025-02-13 14:13:49 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2025-02-13 14:13:49 +0530
commit8a2e1006b3b272126332aa064f3ad95387129544 (patch)
tree944c80ac612a65980d94a54ba11b6c7102037ecf /.config/zsh/oh-my-zsh/plugins/fossil/_fossil
parentdcbb16d8b08ff5956abef5e6478b59df2e93ad35 (diff)
downloaddotfiles-master.tar.gz
dotfiles-master.tar.bz2
dotfiles-master.zip
new dot filesHEADmaster
Diffstat (limited to '.config/zsh/oh-my-zsh/plugins/fossil/_fossil')
-rw-r--r--.config/zsh/oh-my-zsh/plugins/fossil/_fossil32
1 files changed, 32 insertions, 0 deletions
diff --git a/.config/zsh/oh-my-zsh/plugins/fossil/_fossil b/.config/zsh/oh-my-zsh/plugins/fossil/_fossil
new file mode 100644
index 0000000..d2d48bd
--- /dev/null
+++ b/.config/zsh/oh-my-zsh/plugins/fossil/_fossil
@@ -0,0 +1,32 @@
+#compdef fossil
+
+function _fossil_get_command_list () {
+ fossil help -a | grep -v "Usage|Common|This is"
+}
+
+function _fossil () {
+ local context state state_descr line
+ typeset -A opt_args
+
+ _arguments \
+ '1: :->command'\
+ '2: :->subcommand'
+
+ case $state in
+ command)
+ local _OUTPUT=$(fossil branch 2>&1 | grep "use --repo")
+ if [[ -z "$_OUTPUT" ]]; then
+ compadd "$(_fossil_get_command_list)"
+ else
+ compadd clone init import help version
+ fi ;;
+ subcommand)
+ case "$words[2]" in
+ help) compadd "$(_fossil_get_command_list)" ;;
+ add) compadd "$(fossil extra)" ;;
+ *) compcall -D ;;
+ esac ;;
+ esac
+}
+
+_fossil "$@"