]> git.ipfire.org Git - location/debian/libloc.git/commitdiff
move to upstream's bash-completion
authorHans-Christoph Steiner <hans@eds.org>
Mon, 17 Mar 2025 08:33:06 +0000 (09:33 +0100)
committerHans-Christoph Steiner <hans@eds.org>
Mon, 17 Mar 2025 12:08:54 +0000 (13:08 +0100)
debian/bash-completion/location [deleted file]
debian/location.bash-completion [deleted file]
debian/location.install

diff --git a/debian/bash-completion/location b/debian/bash-completion/location
deleted file mode 100644 (file)
index 66fc6c1..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-# location(1) completion                                   -*- shell-script -*-
-#
-# bash-completion - part of libloc
-#
-# Copyright (C) 2020,2023 Hans-Christoph Steiner <hans@eds.org>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 2.1 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-__location_init() {
-    if type -t _init_completion >/dev/null; then
-        _init_completion -n : || return
-    else
-       # manual initialization for older bash completion versions
-       COMPREPLY=()
-       cur="${COMP_WORDS[COMP_CWORD]}"
-       prev="${COMP_WORDS[COMP_CWORD-1]}"
-    fi
-
-    (( $# >= 1 )) && __complete_${1}
-    __ltrim_colon_completions "$cur"
-}
-
-__complete_options() {
-    case "${prev}" in
-        --directory)
-            _filedir -d
-            return 0;;
-        --cron)
-           COMPREPLY=( $( compgen -W "daily weekly monthly" -- $cur ) )
-            return 0;;
-       --family)
-           COMPREPLY=( $( compgen -W "ipv6 ipv4" -- $cur ) )
-            return 0;;
-        --format)
-           COMPREPLY=( $( compgen -W "ipset list nftables xt_geoip" -- $cur ) )
-            return 0;;
-    esac
-
-    case "$cur" in
-       -*)
-           COMPREPLY=( $( compgen -W "--help ${lopts}" -- $cur ) )
-           return 0;;
-    esac
-}
-
-__complete_dump() {
-    __complete_options
-}
-
-__complete_get_as() {
-    __complete_options
-}
-
-__complete_export() {
-    lopts="--directory --family --format"
-    __complete_options
-}
-
-__complete_list_networks_by_as() {
-    lopts="--family --format"
-    __complete_options
-}
-
-__complete_list_networks_by_cc() {
-    lopts="--family --format"
-    __complete_options
-}
-
-__complete_list_networks_by_flags() {
-    lopts="--anonymous-proxy --satellite-provider --anycast --drop --family --format"
-    __complete_options
-}
-
-__complete_list_bogons() {
-    lopts="--family --format"
-    __complete_options
-}
-
-__complete_list_countries() {
-    lopts="--show-name --show-continent"
-    __complete_options
-}
-
-__complete_lookup() {
-    __complete_options
-}
-
-__complete_search_as() {
-    __complete_options
-}
-
-__complete_update() {
-    lopts="--cron"
-    __complete_options
-}
-
-__complete_version() {
-    __complete_options
-}
-
-__complete_verify() {
-    __complete_options
-}
-
-# for f in `location|grep -Eo '[a-z,-]+,[a-z,-]+'| sed 's/,/ /g'`; do printf '%s \\\n' $f; done|sort -u
-__cmds=" \
-dump \
-export \
-get-as \
-list-bogons \
-list-countries \
-list-networks-by-as \
-list-networks-by-cc \
-list-networks-by-flags \
-lookup \
-search-as \
-update \
-verify \
-version \
-"
-
-for c in $__cmds; do
-    eval "_location_${c} () {
-                local cur prev lopts
-                __location_init ${c//-/_}
-        }"
-done
-
-_location() {
-    local cmd
-    cmd=${COMP_WORDS[1]}
-
-    [[ $__cmds == *\ $cmd\ * ]] && _location_${cmd} || {
-            (($COMP_CWORD == 1)) && COMPREPLY=( $( compgen -W "${__cmds}" -- $cmd ) )
-        }
-}
-
-complete -F _location location
-
-return 0
diff --git a/debian/location.bash-completion b/debian/location.bash-completion
deleted file mode 100644 (file)
index 9838912..0000000
+++ /dev/null
@@ -1 +0,0 @@
-debian/bash-completion/location location
index 240ac2a41c11c346581e3269049685bd632e0e0d..fe5f946de22f30d8224f9e19d5fc9c68dc2e40c3 100644 (file)
@@ -1,3 +1,4 @@
 usr/bin
+usr/share/bash-completion/completions/location
 var/lib/location/signing-key.pem
 usr/lib/systemd/system