Gentoo Archives: gentoo-dev

From: Ulrich Mueller <ulm@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Unifying option passing conventions in the PMS
Date: Mon, 01 Sep 2014 13:35:52
Message-Id: 21508.30254.117504.515064@a1i15.kph.uni-mainz.de
In Reply to: [gentoo-dev] Unifying option passing conventions in the PMS by "Michał Górny"
1 >>>>> On Mon, 1 Sep 2014, Michał Górny wrote:
2
3 > 1. Options must precede positional parameters on the command-line.
4 > Interspersing options and positional parameters is not allowed.
5
6 > 2. Each short option must be specified as a separate parameter.
7 > Specifying multiple short options in one parameter is not allowed.
8
9 > 3. If a helper supports any options, then the positional parameters
10 > may not resemble options. In particular, passing any positional
11 > parameters beginning with '-' is not allowed.
12
13 > 4. [optionally] If a helper supports any options, '--' option may be
14 > used to terminate option parsing. All parameters following it will
15 > be treated as positional parameters, and rule 3. doesn't apply to
16 > parameters following '--'.
17
18 > 5. Helpers should define both short and long variants for each
19 > option they provide.
20
21 > 6. If the option takes a parameter, it should be passed as
22 > the parameter immediately following it. Concatenating option
23 > and the parameter is not allowed. Interspersing multiple options
24 > and their parameters is not allowed.
25
26 There is a standard for options and their arguments [1]. It is
27 implemented in the getopt(3) function in C and in the getopts(1)
28 command, which is a bash builtin.
29
30 So if we are going to change anything with respect to option parsing
31 in package manager commands, then lets please stick to these
32 established guidelines, instead of inventing our own (at least partly)
33 incompatible rules.
34
35 Ulrich
36
37 [1] Utility Syntax Guidelines 3 to 10,
38 http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02

Replies

Subject Author
Re: [gentoo-dev] Unifying option passing conventions in the PMS "Michał Górny" <mgorny@g.o>