Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add full-length versions of CLI flags #11776

Merged
merged 9 commits into from Dec 27, 2023

Conversation

hugovk
Copy link
Contributor

@hugovk hugovk commented Nov 28, 2023

Feature or Bugfix

  • Feature

Purpose

  • Improve usability of sphinx-build

Detail

  • I find it very difficult to remember what the single letter command-line arguments are for sphinx-build and often have to re-look them up via --help
  • I usually use sphinx-build via a Makfile, and long options are just fine there, and better at self-documenting
  • Long options are a CLI best practice, see Command Line Interface Guidelines

Have full-length versions of all flags. For example, have both -h and --help. Having the full version is useful in scripts where you want to be verbose and descriptive, and you don’t have to look up the meaning of flags everywhere.

Please define long-named options that are equivalent to the single-letter Unix-style options. We hope to make GNU more user friendly this way.


I didn't add any for these two because I wasn't sure what their long versions could be:

  • -D setting=value
  • -A name=value

Relates

doc/man/sphinx-build.rst Outdated Show resolved Hide resolved
.. versionchanged:: 7.3
Add ``--write`` long option.

.. option:: -W, --errors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would --fail-fast be a better name than --errors?
I don't find --errors particularly descriptive.

Copy link
Contributor Author

@hugovk hugovk Nov 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this option is often used in combination with:

  --keep-going          with -W, keep going when getting warnings

My thinking was these might go together:

--errors --keep-going

And --fail-fast would seem to contradict it:

--fail-fast --keep-going

Open to other suggestions!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, I would have suggested --fatal-warnings because it's exactly what it does for gcc. Or we can go for --warning-is-error or --warn-as-error (but I would prefer the former).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer --fail-on-warning here, it's more descriptive, if a little wordier.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually try to come with flags that are used by other well-known tools because it makes less options to remember overall, but I think yours is a bit betetr when used with --keep-going

hugovk and others added 2 commits November 29, 2023 11:22
Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
.. versionchanged:: 7.3
Add ``--all`` long option.

.. option:: -E, --no-env
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe --isolate or --no-incremental to mimick Python/mypy options (I think --no-incremental is more correct since --isolate may assume not looking for the configuration file).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruff has --isolated to ignore config:

      --isolated
          Ignore all configuration files

Mypy has --no-incremental to disable the cacge:

Incremental mode:
  Adjust how mypy incrementally type checks and caches modules. Mypy caches type information about modules into a cache to let you speed up future
  invocations of mypy. Also see mypy's daemon mode: mypy.readthedocs.io/en/stable/mypy_daemon.html#mypy-daemon

  --no-incremental          Disable module cache (inverse: --incremental)

I couldn't find similar Python options.

Mypy's --no-incremental seems closer, will update to use that 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fot Python it's -I for "isolated".

doc/man/sphinx-build.rst Outdated Show resolved Hide resolved
doc/man/sphinx-build.rst Outdated Show resolved Hide resolved
.. versionchanged:: 7.3
Add ``--write`` long option.

.. option:: -W, --errors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, I would have suggested --fatal-warnings because it's exactly what it does for gcc. Or we can go for --warning-is-error or --warn-as-error (but I would prefer the former).

doc/man/sphinx-build.rst Outdated Show resolved Hide resolved
doc/man/sphinx-build.rst Outdated Show resolved Hide resolved
doc/man/sphinx-build.rst Outdated Show resolved Hide resolved
doc/man/sphinx-build.rst Outdated Show resolved Hide resolved
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
@picnixz
Copy link
Member

picnixz commented Dec 24, 2023

Btw for the -D it's simply --define and for the -A I think it should be something like --var=... or --html-var or --jinja-var since it's for templates only iirc.

@AA-Turner
Copy link
Member

An alternate suggestion for -D would be --config-override, to be more descriptive that the option is intended to override settings in the configuration file.

A

doc/man/sphinx-build.rst Outdated Show resolved Hide resolved
@AA-Turner AA-Turner merged commit aea69ea into sphinx-doc:master Dec 27, 2023
21 of 22 checks passed
@hugovk hugovk deleted the add--long-options branch December 27, 2023 05:07
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants