Skip to content

Docs: Remove defaults for (boolean)flags/options that expect no value #9406

@thaJeztah

Description

@thaJeztah

Related: #9393, #5545

The way that default values for boolean flags/options is documented is confusing for some people and choosing a simpler notation could take away that confusion.

For example;

-v, --version=false               Print version information and quit

Could be interpreted as;

"To print version information, run docker --version=false", whereas it should be used;
docker --version.

Technically, it could be used as docker --version=true, but I doubt many people will find
that useful, so not documenting this seems reasonable to me.

Proposed change

Change the documentation (and help) for flags/options that don't require/expect a value, and
remove the default value. Flags that do accept a value should still mention this.

The documentation will look like this;

-v, --version               Print version information and quit

Other software

I did a quick check how other software handles this. Some examples are below;

# MySQL:
 -V, --version       Output version information and exit.
 --select-limit=#    Automatic limit for SELECT when using --safe-updates.

 --server-arg=name   Send embedded server this as a parameter.

# GIT
usage: git [--version] [--help] [-C <path>] [-c name=value]    

# Fig
Options:
  --version                 Print version and exit
  -f, --file FILE           Specify an alternate fig file (default: fig.yml)
  -p, --project-name NAME   Specify an alternate project name (default: directory name)

# SubVersion (svn checkout)
Valid options:
  -r [--revision] ARG      : ARG (some commands also take ARG1:ARG2 range)
                             [edited]
  -q [--quiet]             : print nothing, or only summary information

NOTE
This proposal does not intent to change the way flags are working right now,
only change the way it is documented. Changing the behavior of flags and renaming
was proposed in the past (#5760, #5764) and voted against / rejected, so please do not bring that up here again.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions