From: Andre Noll Date: Sat, 3 May 2025 18:07:34 +0000 (+0200) Subject: bash completion: Fix help option parsing. X-Git-Url: https://git.tuebingen.mpg.de/?a=commitdiff_plain;h=69d4838d0ae1eedb59166146dd3f1ead902dd6fc;p=paraslash.git 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. --- 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 }