From b3d8167548803364b62ecb8cafafe0f78802497c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 2 Apr 2019 01:53:10 +0200 Subject: [PATCH] Generate yunohost_completion.py during debian builds --- data/bash-completion.d/yunohost | 15 +---- data/bash-completion.d/yunohost_completion | 77 ---------------------- debian/rules | 4 ++ 3 files changed, 7 insertions(+), 89 deletions(-) delete mode 100644 data/bash-completion.d/yunohost_completion diff --git a/data/bash-completion.d/yunohost b/data/bash-completion.d/yunohost index 106f8fbdf..2572a391d 100644 --- a/data/bash-completion.d/yunohost +++ b/data/bash-completion.d/yunohost @@ -1,12 +1,3 @@ -# -# Bash completion for yunohost -# - -_python_argcomplete() { - local IFS=' ' - COMPREPLY=( $(IFS="$IFS" COMP_LINE="$COMP_LINE" COMP_POINT="$COMP_POINT" _ARGCOMPLETE_COMP_WORDBREAKS="$COMP_WORDBREAKS" _ARGCOMPLETE=1 "$1" 8>&1 9>&2 1>/dev/null 2>/dev/null) ) - if [[ $? != 0 ]]; then - unset COMPREPLY - fi -} -complete -o nospace -o default -F _python_argcomplete "yunohost" +# This file is automatically generated +# during Debian's package build by the script +# data/actionsmap/yunohost_completion.py diff --git a/data/bash-completion.d/yunohost_completion b/data/bash-completion.d/yunohost_completion deleted file mode 100644 index 715073475..000000000 --- a/data/bash-completion.d/yunohost_completion +++ /dev/null @@ -1,77 +0,0 @@ -# -# completion for yunohost -# automatically generated from the actionsmap -# - -_yunohost_completion() -{ - local cur prev opts narg - COMPREPLY=() - - # the number of words already typed - narg=${#COMP_WORDS[@]} - - # the current word being typed - cur="${COMP_WORDS[COMP_CWORD]}" - - # the last typed word - prev="${COMP_WORDS[COMP_CWORD-1]}" - - # If one is currently typing a domain, - # match with domains - if [[ $narg == 2 ]]; then - opts="user domain log service settings firewall backup app hook dyndns tools monitor" - fi - - # If one already typed a domain, - # match the actions of that domain - if [[ $narg == 3 ]]; then - if [[ $prev == "user" ]]; then - opts="info create list update delete" - fi - if [[ $prev == "domain" ]]; then - opts="cert-install cert-status list remove url-available add dns-conf cert-renew" - fi - if [[ $prev == "log" ]]; then - opts="list display" - fi - if [[ $prev == "service" ]]; then - opts="status enable reload_or_restart log start stop remove reload add disable regen-conf restart" - fi - if [[ $prev == "settings" ]]; then - opts="reset set list reset-all get" - fi - if [[ $prev == "firewall" ]]; then - opts="reload allow stop list upnp disallow" - fi - if [[ $prev == "backup" ]]; then - opts="info restore create list delete" - fi - if [[ $prev == "app" ]]; then - opts="map checkurl install makedefault checkport listlists change-url removelist info change-label upgrade fetchlist clearaccess ssowatconf list remove register-url removeaccess setting initdb debug addaccess" - fi - if [[ $prev == "hook" ]]; then - opts="info callback add exec list remove" - fi - if [[ $prev == "dyndns" ]]; then - opts="subscribe update installcron removecron" - fi - if [[ $prev == "tools" ]]; then - opts="upgrade ldapinit postinstall maindomain update reboot shell adminpw shutdown diagnosis port-available" - fi - if [[ $prev == "monitor" ]]; then - opts="enable network show-stats update-stats disk system disable" - fi - fi - - # If no options were found propose --help - if [ -z "$opts" ]; then - if [[ $prev != "--help" ]]; then - opts=( --help ) - fi - fi - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 -} - -complete -F _yunohost_completion yunohost \ No newline at end of file diff --git a/debian/rules b/debian/rules index ce03d0e31..d012c73f3 100755 --- a/debian/rules +++ b/debian/rules @@ -7,6 +7,10 @@ %: dh ${@} --with=python2,systemd +override_dh_auto_build: + # Generate bash completion file + python data/actionsmap/yunohost_completion.py + override_dh_installinit: dh_installinit -pyunohost --name=yunohost-api --restart-after-upgrade dh_installinit -pyunohost --name=yunohost-firewall --noscripts