Skip to content

Make the --help page more useful #131

Description

@TheTrueWhiteOwl

Currently using the brightnessctl command is easy to understand for the basic use cases, but the pages shown when the --help option is passed could be structured better so as to make the different operations easier to understand.

Main help page

The basic brightnessctl --help would show a page that shows only the options available for every operation and the basic operation descriptions. For example something like the following:

$ brightnessctl --help
Usage: brightnessctl [options...] [operation]

Options:
  -q, --quiet			suppress output.
  -p, --pretend			do not perform write operations.
  -m, --machine-readable	produce machine-readable output.
  -d, --device=DEVICE		specify device name (can be a wildcard).
  -c, --class=CLASS		specify device class.
  -h, --help			print this help.
  -V, --version			print version and exit.

Operations:
  i, info			get device info (the default operation).
  l, list			list info for devices with available brightness controls.<<<BREAKING CHANGE!!!
  g, get			get current brightness of the device.
  m, max			get maximum brightness of the device.
  s, set <value>		set brightness of the device.
  S, save			save current state in a temporary file.		<<<BREAKING CHANGE!!!
  r, restore			restore previously saved state.			<<<BREAKING CHANGE!!!

use 'brightnessctl --help' with an operation for more information on its usage and available options

Here is my explanation for the suggested Breaking Changes (Also note that they don't necessarily need to be breaking changes, the old options can be kept around for a while)

The old --list option essentially overwrites whatever operation you passed it with and simply lists all devices/all devices of the class that you passed into the --class option. It is actually very similar to the info operation (and should in my opinion actually replace it, since the info operation behaves in strange ways that are obvious with list, e.g. using the --class option with info only prints the first device of that class, whilst list shows all devices of said class.

The --restore option also felt strange as an option, since there was really no operation that it was meant to be used with (because it is essentially an operation of its own)

I also put the --save option as an operation too since it mirrors the new restore operation and also allows us to do away with the need to specify that --save saves the "previous state" (I think it is pretty obvious that the new save operation simply saves the current state.

Another small change was the removal of the version number line at the top of the --help page since if that is wanted it can be seen using --version anyways.

Sub pages

Every operation has its own --help page that lists the options relevant to that specific operation. For example the (arguably) most important operation set:

$ brightnessctl --help set
Usage: brightnessctl [options...] set <value>

Options:
  -q, --quiet			suppress output.
  -p, --pretend			do not perform write operations.
  -m, --machine-readable	produce machine-readable output.
  -d, --device=DEVICE		specify device name (can be a wildcard).
  -c, --class=CLASS		specify device class.
  -h, --help			print this help.
  -V, --version			print version and exit.

Operation Specific Options:
  -n, --min-value[=n]		set minimum brightness, defaults to 1.
  -e, --exponent[=K]		changes percentage curve to exponential.
  -s, --save			save previous state in a temporary file.	<<<CAN BE KEPT TO AVOID BREAKING CHANGES
  -r, --restore			restore previous saved state.			<<<CAN BE KEPT TO AVOID BREAKING CHANGES

Valid values:
  specific value		Example: 500
  percentage value		Example: 50%
  specific delta		Example: 50- or 25+ or +10
  percentage delta		Example: 50%- or 25.5%+ or +10%

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions