From 200e1ca7b7074c01e9b7a1ab8961fd759c5ed108 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Wed, 3 Dec 2025 16:38:48 +0900 Subject: [PATCH] mysql-admutils: fix generated completions There is a bug in clap dynamic completions, where it does not account for alternative binary names. This hack should fix it for now --- create-deb.sh | 4 ++++ nix/default.nix | 3 +++ 2 files changed, 7 insertions(+) diff --git a/create-deb.sh b/create-deb.sh index 13d31a5..07d0efa 100755 --- a/create-deb.sh +++ b/create-deb.sh @@ -18,6 +18,10 @@ mkdir -p assets/completions COMPLETE=bash mysql-useradm > assets/completions/mysql-useradm.bash COMPLETE=zsh mysql-useradm > assets/completions/_mysql-useradm COMPLETE=fish mysql-useradm > assets/completions/mysql-useradm.fish + + # See https://github.com/clap-rs/clap/issues/1764 + sed -i 's/muscl/mysql-dbadm/g' assets/completions/{mysql-dbadm.bash,mysql-dbadm.fish,_mysql-dbadm} + sed -i 's/muscl/mysql-useradm/g' assets/completions/{mysql-useradm.bash,mysql-useradm.fish,_mysql-useradm} ) cargo deb diff --git a/nix/default.nix b/nix/default.nix index 918fce2..3a5e559 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -29,6 +29,9 @@ buildFunction { export PATH="$out/bin:$PATH" export COMPLETE="${shell}" "${command}" > "$TMP/${command}.${shell}" + + # See https://github.com/clap-rs/clap/issues/1764 + sed -i 's/muscl/${command}/g' "$TMP/${command}.${shell}" ) installShellCompletion "--${shell}" --cmd "${command}" "$TMP/${command}.${shell}" '') {