From 12c7b8ab224679990ba626569d5b9167582e5b1a Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 19 Jan 2023 14:08:01 +0100 Subject: tv wwan: add uqmi bash-completion --- tv/3modules/wwan.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tv/3modules/wwan.nix b/tv/3modules/wwan.nix index a60d314..03cd512 100644 --- a/tv/3modules/wwan.nix +++ b/tv/3modules/wwan.nix @@ -33,6 +33,20 @@ with import ./lib; (pkgs.writeDashBin "uqmi" '' exec ${pkgs.uqmi}/bin/uqmi --device=${cfg.device} "$@" '') + (pkgs.writeTextDir "share/bash-completion/completions/uqmi" /* sh */'' + _uqmi_complete() { + case ''${#COMP_WORDS[@]} in + 2) + COMPREPLY=($(compgen -W "$( + ${pkgs.uqmi}/bin/uqmi --help 2>&1 | + ${pkgs.coreutils}/bin/tr , \\n | + ${pkgs.gnused}/bin/sed -nr 's/^ *(-[a-z-]+).*/\1/p' + )" -- "''${COMP_WORDS[1]}")) + ;; + esac + } + complete -F _uqmi_complete uqmi + '') pkgs.uqmi ]; }; -- cgit v1.2.3