bugGNU Gengetopt - Bugs: bug #34399, Mutually-exclusive groups...

 
 

bug #34399: Mutually-exclusive groups considered harmful

Submitter:  Reuben Thomas <rrt>
Submitted:  Mon 26 Sep 2011 09:10:01 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Originator Name:  Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 10 Mar 2021 09:16:04 AM UTC, comment #3: 

Having just reimplemented `mmv`'s command-line parser with gengetopt, I modify my stance once more: for mmv, it is probably good to have an error when two mutually-exclusive options are given, as they change drastically how the program operates.

However, it would be good to be able to specify for a group whether it is an error for more than one option to be given, or whether the latest should win.

Reuben Thomas <rrt>
Tue 27 Sep 2011 12:39:11 AM UTC, comment #2: 

I am sorry, my initial analysis is faulty. Groups should be kept, but multiple settings should be allowed on the command line, with later flags overriding earlier flags, rather than causing an error.

Apologies for the confused initial analysis.

Reuben Thomas <rrt>
Mon 26 Sep 2011 09:13:54 PM UTC, comment #1: 

It is not normal for command-line programs to have mutually-exclusive group flags. The reason for this is that a command-line may be assembled by more than one cooperating program. The standard way to deal with mutually exclusive flags is for the last flag given to take precedence over previous flags.

For example, consider the sort order of ls.

Removing groups would not only encourage authors to write more flexible command-line programs, but it would also make it easier to understand modes, which are very similar to groups. For example, look at the main menu of the info manual:

  • Group options::               Groups of mutual exclusive options
  • Mode options::                Mutual exclusive group of options


The sub-headings look very similar! Getting rid of groups would be an easy way to fix this confusion.

Reuben Thomas <rrt>
Mon 26 Sep 2011 09:10:01 PM UTC, original submission:  


Reuben Thomas <rrt>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rrt (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-12ab.
    Corresponding source code