Add zsh completion scripts

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2020-02-25 13:56:39 +01:00 committed by Dietmar Maurer
parent ea5f547fdc
commit 6dea60aa9f
7 changed files with 48 additions and 2 deletions

View File

@ -120,11 +120,14 @@ lint:
install: $(COMPILED_BINS) install: $(COMPILED_BINS)
install -dm755 $(DESTDIR)$(BINDIR) install -dm755 $(DESTDIR)$(BINDIR)
install -dm755 $(DESTDIR)$(ZSH_COMPL_DEST)
$(foreach i,$(USR_BIN), \ $(foreach i,$(USR_BIN), \
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ;) install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(BINDIR)/ ; \
install -m644 zsh-completions/_$(i) $(DESTDIR)$(ZSH_COMPL_DEST)/ ;)
install -dm755 $(DESTDIR)$(SBINDIR) install -dm755 $(DESTDIR)$(SBINDIR)
$(foreach i,$(USR_SBIN), \ $(foreach i,$(USR_SBIN), \
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ;) install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(SBINDIR)/ ; \
install -m644 zsh-completions/_$(i) $(DESTDIR)$(ZSH_COMPL_DEST)/ ;)
install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup install -dm755 $(DESTDIR)$(LIBEXECDIR)/proxmox-backup
$(foreach i,$(SERVICE_BIN), \ $(foreach i,$(SERVICE_BIN), \
install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;) install -m755 $(COMPILEDIR)/$(i) $(DESTDIR)$(LIBEXECDIR)/proxmox-backup/ ;)

View File

@ -2,3 +2,5 @@ usr/bin/proxmox-backup-client
usr/bin/pxar usr/bin/pxar
usr/share/man/man1/proxmox-backup-client.1 usr/share/man/man1/proxmox-backup-client.1
usr/share/man/man1/pxar.1 usr/share/man/man1/pxar.1
usr/share/zsh/vendor-completions/_proxmox-backup-client
usr/share/zsh/vendor-completions/_pxar

View File

@ -11,3 +11,4 @@ usr/share/javascript/proxmox-backup/images/proxmox_logo.png
usr/share/javascript/proxmox-backup/js/proxmox-backup-gui.js usr/share/javascript/proxmox-backup/js/proxmox-backup-gui.js
usr/share/man/man1/proxmox-backup-manager.1 usr/share/man/man1/proxmox-backup-manager.1
usr/share/man/man1/proxmox-backup-proxy.1 usr/share/man/man1/proxmox-backup-proxy.1
usr/share/zsh/vendor-completions/_proxmox-backup-manager

View File

@ -8,6 +8,7 @@ MAN1DIR = $(PREFIX)/share/man/man1
DOCDIR = $(PREFIX)/share/doc/proxmox-backup DOCDIR = $(PREFIX)/share/doc/proxmox-backup
JSDIR = $(DATAROOTDIR)/javascript/proxmox-backup JSDIR = $(DATAROOTDIR)/javascript/proxmox-backup
SYSCONFDIR = /etc SYSCONFDIR = /etc
ZSH_COMPL_DEST = $(PREFIX)/share/zsh/vendor-completions
# For local overrides # For local overrides
-include local.mak -include local.mak

View File

@ -0,0 +1,13 @@
#compdef _proxmox-backup-client() proxmox-backup-client
function _proxmox-backup-client() {
local cwords line point cmd curr prev
cworkds=${#words[@]}
line=$words
point=${#line}
cmd=${words[1]}
curr=${words[cwords]}
prev=${words[cwords-1]}
compadd -- $(COMP_CWORD="$cwords" COMP_LINE="$line" COMP_POINT="$point" \
proxmox-backup-client bashcomplete "$cmd" "$curr" "$prev")
}

View File

@ -0,0 +1,13 @@
#compdef _proxmox-backup-manager() proxmox-backup-manager
function _proxmox-backup-manager() {
local cwords line point cmd curr prev
cworkds=${#words[@]}
line=$words
point=${#line}
cmd=${words[1]}
curr=${words[cwords]}
prev=${words[cwords-1]}
compadd -- $(COMP_CWORD="$cwords" COMP_LINE="$line" COMP_POINT="$point" \
proxmox-backup-manager bashcomplete "$cmd" "$curr" "$prev")
}

13
zsh-completions/_pxar Normal file
View File

@ -0,0 +1,13 @@
#compdef _pxar() pxar
function _pxar() {
local cwords line point cmd curr prev
cworkds=${#words[@]}
line=$words
point=${#line}
cmd=${words[1]}
curr=${words[cwords]}
prev=${words[cwords-1]}
compadd -- $(COMP_CWORD="$cwords" COMP_LINE="$line" COMP_POINT="$point" \
pxar bashcomplete "$cmd" "$curr" "$prev")
}