From dd8f7638c5de51ed4563d28b7a13e0034b55c1ae Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Thu, 6 Apr 2017 13:05:47 +0000 Subject: [PATCH] add bash completion scripts --- debian-alt/jessie/rules | 2 +- debian-alt/precise/rules | 2 +- debian-alt/trusty/rules | 2 +- debian-alt/wheezy/rules | 2 +- debian-alt/xenial/rules | 2 +- debian/i2p-router.bash-completion | 1 + debian/i2p.bash-completion | 2 + debian/rules | 2 +- installer/resources/bash-completion/eepget | 55 +++++++++++++++++++ installer/resources/bash-completion/i2prouter | 12 ++++ .../bash-completion/i2prouter-nowrapper | 12 ++++ 11 files changed, 88 insertions(+), 6 deletions(-) create mode 100644 debian/i2p-router.bash-completion create mode 100644 debian/i2p.bash-completion create mode 100644 installer/resources/bash-completion/eepget create mode 100644 installer/resources/bash-completion/i2prouter create mode 100644 installer/resources/bash-completion/i2prouter-nowrapper diff --git a/debian-alt/jessie/rules b/debian-alt/jessie/rules index 94ad107b23..9fadb6a2b1 100755 --- a/debian-alt/jessie/rules +++ b/debian-alt/jessie/rules @@ -38,7 +38,7 @@ export BITS := $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS) #export DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU) %: - dh $@ --with systemd,quilt + dh $@ --with systemd,quilt,bash-completion clean: createcopyright diff --git a/debian-alt/precise/rules b/debian-alt/precise/rules index 826b6a5fa0..3962457e55 100755 --- a/debian-alt/precise/rules +++ b/debian-alt/precise/rules @@ -39,7 +39,7 @@ export BITS := $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS) #export DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU) %: - dh $@ + dh $@ --with bash-completion clean: createcopyright diff --git a/debian-alt/trusty/rules b/debian-alt/trusty/rules index a4907fef8f..e33ce31f44 100755 --- a/debian-alt/trusty/rules +++ b/debian-alt/trusty/rules @@ -38,7 +38,7 @@ export BITS := $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS) #export DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU) %: - dh $@ --with systemd + dh $@ --with systemd,bash-completion clean: createcopyright diff --git a/debian-alt/wheezy/rules b/debian-alt/wheezy/rules index 61b5ac37f4..b96fecdd14 100755 --- a/debian-alt/wheezy/rules +++ b/debian-alt/wheezy/rules @@ -36,7 +36,7 @@ export DEBIANVERSION := $(shell dpkg-parsechangelog |awk -F' ' '/^Version:/{prin #export DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU) %: - dh $@ --with systemd + dh $@ --with systemd,bash-completion clean: createcopyright diff --git a/debian-alt/xenial/rules b/debian-alt/xenial/rules index c70f194383..9734f3442b 100755 --- a/debian-alt/xenial/rules +++ b/debian-alt/xenial/rules @@ -38,7 +38,7 @@ export BITS := $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS) #export DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU) %: - dh $@ --with systemd + dh $@ --with systemd,bash-completion clean: createcopyright diff --git a/debian/i2p-router.bash-completion b/debian/i2p-router.bash-completion new file mode 100644 index 0000000000..bfb55196fb --- /dev/null +++ b/debian/i2p-router.bash-completion @@ -0,0 +1 @@ +installer/resources/bash-completion/eepget diff --git a/debian/i2p.bash-completion b/debian/i2p.bash-completion new file mode 100644 index 0000000000..d82584a60c --- /dev/null +++ b/debian/i2p.bash-completion @@ -0,0 +1,2 @@ +installer/resources/bash-completion/i2prouter +installer/resources/bash-completion/i2prouter-nowrapper diff --git a/debian/rules b/debian/rules index 00f0f6b93b..5b8cc658c9 100755 --- a/debian/rules +++ b/debian/rules @@ -38,7 +38,7 @@ export BITS := $(shell dpkg-architecture -qDEB_HOST_ARCH_BITS) #export DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU) %: - dh $@ --with systemd,quilt + dh $@ --with systemd,quilt,bash-completion clean: createcopyright diff --git a/installer/resources/bash-completion/eepget b/installer/resources/bash-completion/eepget new file mode 100644 index 0000000000..388c51d4b2 --- /dev/null +++ b/installer/resources/bash-completion/eepget @@ -0,0 +1,55 @@ +_eepget() +{ + local cur prev opts + _init_completion || return + + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="-c -e -h -l -m -n -o -p -t -u -x" + + case "${prev}" in + -e|-h|-u|-x) + return + ;; + -l|-m|-t) + if [[ $cur == "" ]]; then + COMPREPLY=( $( compgen -P "$cur" -W "{1..9}" ) ) + elif [[ $cur == "0" ]]; then + COMPREPLY=( $( compgen -W "$cur" ) ) + else + COMPREPLY=( $( compgen -P "$cur" -W "{0..9}" ) ) + fi + compopt -o nospace + return + ;; + -n) + if [[ $cur == "0" ]]; then + COMPREPLY=( $( compgen -W "$cur" ) ) + else + COMPREPLY=( $( compgen -P "$cur" -W "{0..9}" ) ) + fi + compopt -o nospace + return + ;; + -o) + _filedir + return + ;; + -p) + _known_hosts_real "$cur" + return + ;; + esac + + if [[ ${cur} == h* ]] ; then + COMPREPLY=( $(compgen -W "http://{a..z}" -- $cur) ) + return + fi + + if [[ ${cur} == -* ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) + return 0 + fi +} +complete -F _eepget eepget diff --git a/installer/resources/bash-completion/i2prouter b/installer/resources/bash-completion/i2prouter new file mode 100644 index 0000000000..14d3b1f16c --- /dev/null +++ b/installer/resources/bash-completion/i2prouter @@ -0,0 +1,12 @@ +_i2prouter() +{ + local cur prev opts + _init_completion || return + + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="console start stop graceful restart condrestart status install remove dump" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) +} +complete -F _i2prouter i2prouter diff --git a/installer/resources/bash-completion/i2prouter-nowrapper b/installer/resources/bash-completion/i2prouter-nowrapper new file mode 100644 index 0000000000..b5dffa33c4 --- /dev/null +++ b/installer/resources/bash-completion/i2prouter-nowrapper @@ -0,0 +1,12 @@ +_i2prouter-nowrapper() +{ + local cur prev opts + _init_completion || return + + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="" + COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) +} +complete -F _i2prouter-nowrapper i2prouter-nowrapper -- GitLab