From 9bce2edc80960948b4d33a4931395b28cd5931d6 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 29 Nov 2019 06:31:58 -0800 Subject: doc: getopt: long and short options appear in index. * txr.1: Document that in the parsed opts object returned by getopts, an option which has two names (long and short form) is indexed under both names if it has occurred in the command line, regardless of whether it has occurred under the short or long name. --- txr.1 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/txr.1 b/txr.1 index 7549eb9a..474aa81b 100644 --- a/txr.1 +++ b/txr.1 @@ -56913,6 +56913,23 @@ is possible. This replaces the value associated with option The assignment is erroneous if no such option was parsed from the command line, even if it is a valid option. +If an option is defined with both a long form and a short form, +and either form of that option occurs in the command line being +processed, then the option appears under both names in the index. + +For instance if option +.str --verbose +has the short form +.strn -v , +and either option occurs, then both the keys +.str "v" +and +.str "verbose" +will exist in the +.code opts +structure returned by +.codn getopts . + .coNP Function @ getopts .synb .mets (getopts < option-desc-list << arg-list ) -- cgit v1.2.3