From 69d4838d0ae1eedb59166146dd3f1ead902dd6fc Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 3 May 2025 20:07:34 +0200 Subject: [PATCH] bash completion: Fix help option parsing. If we complete on para_client or para_audioc options rather than on server or audiod subcommands, we parse the --help output to determine the options to complete on. The regular expression we currently use for that is too lenient because it also matches the options in the synopsis section of the help output. Fix this by prefixing the expression with '^' to extract only the options of the subsequent help text. --- bash_completion | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bash_completion b/bash_completion index 88b37dc2..5135101b 100644 --- a/bash_completion +++ b/bash_completion @@ -8,11 +8,11 @@ _para_complete() # This extracts short and long options from the help output local script='{ - if ($1 ~ "-[a-zA-Z]," && $2 ~ "--[a-zA-Z]") { + if ($1 ~ "^-[a-zA-Z]," && $2 ~ "^--[a-zA-Z]") { print substr($1, 0, 2); gsub("=.*", "", $2) print $2 - } else if ($1 ~ "--[a-zA-Z]") { + } else if ($1 ~ "^--[a-zA-Z]") { gsub("=.*", "", $1) print $1 } -- 2.39.5