summaryrefslogtreecommitdiffstats
path: root/tv
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2023-01-19 14:08:01 +0100
committertv <tv@krebsco.de>2023-01-19 14:08:27 +0100
commit57abca263fe86259807e5597d1c8f11c3c3acd44 (patch)
treecacaa892a602b2ebc69173d8fa21220d9a246abc /tv
parent3e5c82d968b571fe3ebd03dcef5d7021c277c01e (diff)
tv wwan: add uqmi bash-completion
Diffstat (limited to 'tv')
-rw-r--r--tv/3modules/wwan.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/tv/3modules/wwan.nix b/tv/3modules/wwan.nix
index a60d314f..03cd512e 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
];
};