mirror of https://github.com/digint/btrbk
contrib: bash: completion.bash: add Bash completion for options
parent
a99292aba8
commit
ac323e8b4b
49
Makefile
49
Makefile
|
@ -8,27 +8,28 @@
|
||||||
# build target for simplicity.
|
# build target for simplicity.
|
||||||
#
|
#
|
||||||
|
|
||||||
BIN = btrbk
|
BIN = btrbk
|
||||||
BIN_LINKS = lsbtr
|
BIN_LINKS = lsbtr
|
||||||
CONFIGS = btrbk.conf.example
|
CONFIGS = btrbk.conf.example
|
||||||
DOCS = ChangeLog \
|
DOCS = ChangeLog \
|
||||||
README.md
|
README.md
|
||||||
SCRIPTS = ssh_filter_btrbk.sh \
|
SCRIPTS = ssh_filter_btrbk.sh \
|
||||||
contrib/cron/btrbk-mail \
|
contrib/cron/btrbk-mail \
|
||||||
contrib/cron/btrbk-verify \
|
contrib/cron/btrbk-verify \
|
||||||
contrib/migration/raw_suffix2sidecar \
|
contrib/migration/raw_suffix2sidecar \
|
||||||
contrib/crypt/kdf_pbkdf2.py
|
contrib/crypt/kdf_pbkdf2.py
|
||||||
|
|
||||||
PN = btrbk
|
PN = btrbk
|
||||||
PREFIX ?= /usr
|
PREFIX ?= /usr
|
||||||
CONFDIR = /etc
|
CONFDIR = /etc
|
||||||
CRONDIR = /etc/cron.daily
|
CRONDIR = /etc/cron.daily
|
||||||
BINDIR = $(PREFIX)/bin
|
BINDIR = $(PREFIX)/bin
|
||||||
DOCDIR = $(PREFIX)/share/doc/$(PN)
|
DOCDIR = $(PREFIX)/share/doc/$(PN)
|
||||||
SCRIPTDIR = $(PREFIX)/share/$(PN)/scripts
|
SCRIPTDIR = $(PREFIX)/share/$(PN)/scripts
|
||||||
SYSTEMDDIR = $(PREFIX)/lib/systemd/system
|
SYSTEMDDIR = $(PREFIX)/lib/systemd/system
|
||||||
MAN1DIR = $(PREFIX)/share/man/man1
|
BASHCOMPDIR = $(PREFIX)/share/bash-completion/completions
|
||||||
MAN5DIR = $(PREFIX)/share/man/man5
|
MAN1DIR = $(PREFIX)/share/man/man1
|
||||||
|
MAN5DIR = $(PREFIX)/share/man/man5
|
||||||
|
|
||||||
ifeq ($(COMPRESS), yes)
|
ifeq ($(COMPRESS), yes)
|
||||||
DOCS := $(addsuffix .gz,$(DOCS))
|
DOCS := $(addsuffix .gz,$(DOCS))
|
||||||
|
@ -42,12 +43,13 @@ replace_vars = sed \
|
||||||
-e "s|@DOCDIR@|$(DOCDIR)|g" \
|
-e "s|@DOCDIR@|$(DOCDIR)|g" \
|
||||||
-e "s|@SCRIPTDIR@|$(SCRIPTDIR)|g" \
|
-e "s|@SCRIPTDIR@|$(SCRIPTDIR)|g" \
|
||||||
-e "s|@SYSTEMDDIR@|$(SYSTEMDDIR)|g" \
|
-e "s|@SYSTEMDDIR@|$(SYSTEMDDIR)|g" \
|
||||||
|
-e "s|@BASHCOMPDIR@|$(BASHCOMPDIR)|g" \
|
||||||
-e "s|@MAN1DIR@|$(MAN1DIR)|g" \
|
-e "s|@MAN1DIR@|$(MAN1DIR)|g" \
|
||||||
-e "s|@MAN5DIR@|$(MAN5DIR)|g"
|
-e "s|@MAN5DIR@|$(MAN5DIR)|g"
|
||||||
|
|
||||||
all: man
|
all: man
|
||||||
|
|
||||||
install: install-bin install-bin-links install-etc install-systemd install-share install-man install-doc
|
install: install-bin install-bin-links install-etc install-completion install-systemd install-share install-man install-doc
|
||||||
|
|
||||||
install-bin:
|
install-bin:
|
||||||
@echo 'installing binary...'
|
@echo 'installing binary...'
|
||||||
|
@ -65,6 +67,11 @@ install-etc:
|
||||||
install -d -m 755 "$(DESTDIR)$(CONFDIR)/btrbk"
|
install -d -m 755 "$(DESTDIR)$(CONFDIR)/btrbk"
|
||||||
install -p -m 644 $(CONFIGS) "$(DESTDIR)$(CONFDIR)/btrbk"
|
install -p -m 644 $(CONFIGS) "$(DESTDIR)$(CONFDIR)/btrbk"
|
||||||
|
|
||||||
|
install-completion:
|
||||||
|
@echo 'installing bash completion...'
|
||||||
|
install -d -m 755 "$(DESTDIR)$(BASHCOMPDIR)"
|
||||||
|
install -p -m 644 contrib/bash/completion.bash "$(DESTDIR)$(BASHCOMPDIR)/$(BIN)"
|
||||||
|
|
||||||
install-systemd:
|
install-systemd:
|
||||||
@echo 'installing systemd service units...'
|
@echo 'installing systemd service units...'
|
||||||
install -d -m 755 "$(DESTDIR)$(SYSTEMDDIR)"
|
install -d -m 755 "$(DESTDIR)$(SYSTEMDDIR)"
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
_btrbk()
|
||||||
|
{
|
||||||
|
local cur prev words cword split
|
||||||
|
_init_completion -s || return
|
||||||
|
|
||||||
|
$split && return
|
||||||
|
|
||||||
|
if [[ $cur == -* ]]; then
|
||||||
|
COMPREPLY=($(compgen -W '$(_parse_help "$1")' -- "$cur"))
|
||||||
|
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
||||||
|
fi
|
||||||
|
} && complete -F _btrbk btrbk
|
||||||
|
|
||||||
|
# ex: filetype=bash
|
Loading…
Reference in New Issue