diff --git a/doc/source/contributor/humaninterfaceguide.rst b/doc/source/contributor/humaninterfaceguide.rst index 0f2624d719..48070e52f1 100644 --- a/doc/source/contributor/humaninterfaceguide.rst +++ b/doc/source/contributor/humaninterfaceguide.rst @@ -185,6 +185,21 @@ Output formats: * user-friendly tables with headers, etc * machine-parsable delimited +.. note:: + + A note on terminology. An **argument** is a positional parameter to the + command. As discussed later, these should be used sparingly in + OpenStackClient. An **option** - also known as a **flag** - is a named + parameter denoted with either a hyphen and a single-letter name (``-r``) or + a double hyphen and a multiple-letter name (``--recursive``). They may or + may not also include a user-specified value (``--file foo.txt`` or + ``--file=foo.txt``). + + For more information on this topic and CLIs in general, refer to the + excellent `Command Line Interface Guidelines website`__. + + .. __: https://clig.dev/#arguments-and-flags + Global Options ~~~~~~~~~~~~~~ @@ -225,46 +240,107 @@ form help option (``-h``) is also available. The standard ``--version`` option displays the name and version on standard output. All other options and commands are ignored when this is present. -Command Object(s) and Action -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Objects and Actions +~~~~~~~~~~~~~~~~~~~ -Commands consist of an object described by one or more words followed by an -action. Commands that require two objects have the primary object ahead of the -action and the secondary object after the action. Any positional arguments -identifying the objects shall appear in the same order as the objects. In -badly formed English it is expressed as "(Take) object-1 (and perform) action -(using) object-2 (to it).":: +Commands consist of an object, described by one or more words, followed by an +action. :: - [] + [] -Examples: +For example: -* ``group add user `` -* ``volume type list`` (note that ``volume type`` is a two-word single object) +* ``group create`` +* ``server set`` +* ``volume type list`` -The ``help`` command is unique as it appears in front of a normal command -and displays the help text for that command rather than execute it. +(note that ``volume type`` is a two-word single object) + +Some commands require two objects. These commands have the primary object ahead of the +action and the secondary object after the action. In badly formed English it is +expressed as "(Take) object-1 (and perform) action (using) object-2 (to it)." :: + + + +For example: + +* ``group add user`` +* ``aggregate add host`` +* ``image remove project`` Object names are always specified in command in their singular form. This is contrary to natural language use. -Command Arguments and Options -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +``help`` +++++++++ + +The ``help`` command is unique as it appears in front of a normal command +and displays the help text for that command rather than execute it. + +Arguments +~~~~~~~~~ + +Commands that interact with a specific instance of an object should accept a +single argument. This argument should be a name or identifier for the object. +:: + + [] + +For example: + +* ``group create `` +* ``server set `` + +(note that ``volume type`` is a two-word single object) + +For commands that require two objects, the commands should accept two +arguments when interacting with specific instances of the two objects. These +arguments should appear in the same order as the objects. :: + + [ ] + +For example: + +* ``group add user `` +* ``aggregate add host `` +* ``image remove project `` + +Options +~~~~~~~ Each command may have its own set of options distinct from the global options. They follow the same style as the global options and always appear between -the command and any positional arguments the command requires. +the command and any arguments the command requires. -Command options shall only have long names. The small range of available -short names makes it hard for a single short option name to have a consistent -meaning across multiple commands. +Command options should only have long names. The small range of available short +names makes it hard for a single short option name to have a consistent meaning +across multiple commands. Option Forms ++++++++++++ -* **boolean**: boolean options shall use a form of ``--|--`` - (preferred) or ``--