scop / bash-completion

Programmable completion functions for bash
GNU General Public License v2.0
2.9k stars 380 forks source link

Completions for 'alternatives' command are broken #1225

Closed siteshwar closed 1 month ago

siteshwar commented 3 months ago

Describe the bug

Completions for 'alternatives' command are broken.

To reproduce

These are the steps to reproduce on Fedora:

  1. Ensure bash-completion package is installed.
  2. Type alternatives <TAB>.

Expected behavior

Different options supported by alternatives command should be listed.

Versions (please complete the following information)

akinomyoga commented 1 month ago

Option names are supposed to be generated by _comp_compgen_help

https://github.com/scop/bash-completion/blob/b44b29ca1078043d2957d68e932e1a27c7e10283/completions/update-alternatives#L86

but the output of alternatives --help is not in a format parsed by _comp_compgen_help:

$ alternatives --help
alternatives version 1.26 - Copyright (C) 2001 Red Hat, Inc.
This may be freely redistributed under the terms of the GNU Public License.

usage: alternatives --install <link> <name> <path> <priority>
                    [--initscript <service>]
                    [--family <family>]
                    [--follower <follower_link> <follower_name> <follower_path>]*
       alternatives --remove <name> <path>
       alternatives --auto <name>
       alternatives --config <name>
       alternatives --display <name>
       alternatives --set <name> <path/family>
       alternatives --list
       alternatives --remove-all <name>
       alternatives --add-follower <name> <path> <follower_link> <follower_name> <follower_path>
       alternatives --remove-follower <name> <path> <follower_name>

common options: --verbose --test --help --usage --version --keep-missing --keep-foreign
                --altdir <directory> --admindir <directory>