bash_completion: Fix '--[no]*' flag parsing

This CL fixes the help flag parsing in the _flag function
to correctly report both options of the --[no]* flag possibilities.

The first filtering regex didn't allow the --[no]blah flags to pass.
This is odd because the second sed expression specifically
transforms these types of flags.

This CL  also makes the _flags function slightly more generic.
This allows for subcommand help flags in the future.
Ex. "cros deploy --help" parsing.

BUG=none
TEST=unset _comp_cache
     declare -A _comp_cache
     ./build_packages --<tab><tab>
TEST=unset _comp_cache
     declare -A _comp_cache
     cros --<tab><tab>

Change-Id: Idf74b8ac92c781f569cb8e2bde297bb9cebcd50f
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/1913090
Tested-by: Craig Hesling <hesling@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
1 file changed