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

Make help command remind users about help-advanced command #14402

Conversation

alexey-tereshenkov-oxb
Copy link
Contributor

@alexey-tereshenkov-oxb alexey-tereshenkov-oxb commented Feb 8, 2022

Work towards #13363

Subsystems:

With advanced options:

$ ./pants help anonymous-telemetry

`anonymous-telemetry` subsystem options
---------------------------------------

Options related to sending anonymous stats to the Pants project, to aid development.
 
Activated by pants.core
Config section: [anonymous-telemetry]
 
None available.
There are advanced options which you can list by running `./pants help-advanced anonymous-telemetry`
$ ./pants help yapf

`yapf` subsystem options
------------------------

A formatter for Python files (https://github.com/google/yapf).
 
Activated by pants.core
Config section: [yapf]
 
  --[no-]yapf-skip
  PANTS_YAPF_SKIP
  skip
      default: False
      current value: False
      Don't use yapf when running `./pants fmt` and `./pants lint`.

  --yapf-args="[<shell_str>, <shell_str>, ...]"
  PANTS_YAPF_ARGS
  args
      default: []
      current value: []
      Arguments to pass directly to yapf, e.g. `--yapf-args="--no-local-style"`.
      
      Certain arguments, specifically `--recursive`, `--in-place`, and `--parallel`, will be ignored because Pants takes care of finding all the relevant files and running the formatting in parallel.

There are advanced options which you can list by running `./pants help-advanced yapf`

Without advanced options:

$ ./pants help cli

`cli` subsystem options
-----------------------

Options for configuring CLI behavior, such as command line aliases.
 
Activated by 
Config section: [cli]
 
  --cli-alias="{'key1': val1, 'key2': val2, ...}"
  PANTS_CLI_ALIAS
  alias
      default: {}
      current value: {
          "all-changed": "--changed-since=HEAD --changed-dependees=transitive",
          "run-pyupgrade": "--backend-packages=pants.backend.experimental.python.lint.pyupgrade fmt"
      } (from pants.toml)
      Register command line aliases.
      Example:
      
          [cli.alias]
          green = "fmt lint check"
          all-changed = "--changed-since=HEAD --changed-dependees=transitive"
      
      This would allow you to run `./pants green all-changed`, which is shorthand for `./pants fmt lint check --changed-since=HEAD --changed-dependees=transitive`.
      
      Notice: this option must be placed in a config file (e.g. `pants.toml` or `pantsrc`) to have any effect.

Goals:

With advanced options:

$ ./pants help tailor

`tailor` goal options
---------------------

Auto-generate BUILD file targets for new source files.
 
Activated by pants.core
Config section: [tailor]
 
  --[no-]tailor-check
  PANTS_TAILOR_CHECK
  check
      default: False
      current value: False
      Do not write changes to disk, only write back what would change. Return code 0 means there would be no changes, and 1 means that there would be.

There are advanced options which you can list by running `./pants help-advanced tailor`

Without advanced options:

$ ./pants help run

`run` goal options
------------------

Runs a binary target.

This goal propagates the return code of the underlying executable.

If your application can safely be restarted while it is running, you can pass `restartable=True` on your binary target (for supported types), and the `run` goal will automatically restart them as all
relevant files change. This can be particularly useful for server applications.
 
Activated by pants.core
Config section: [run]
 
  --run-args="[<shell_str>, <shell_str>, ...]"
  ... -- [<shell_str> [<shell_str> [...]]]
  PANTS_RUN_ARGS
  args
      default: []
      current value: [] (from command-line flag)
      Arguments to pass directly to the executed target, e.g. `--run-args="val1 val2 --debug"`

  --[no-]run-cleanup
  PANTS_RUN_CLEANUP
  cleanup
      default: True
      current value: True
      Whether to clean up the temporary directory in which the binary is chrooted. Set to false to retain the directory, e.g., for debugging.


Targets do not have a concept of an option and therefore do not need any special handling.

@alexey-tereshenkov-oxb
Copy link
Contributor Author

Example appearance in the terminal:

Screenshot 2022-02-08 at 19 46 25

Copy link
Member

@kaos kaos left a comment

Choose a reason for hiding this comment

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

Thanks, good idea!

src/python/pants/help/help_formatter.py Show resolved Hide resolved
src/python/pants/help/help_formatter.py Outdated Show resolved Hide resolved
src/python/pants/help/help_printer.py Outdated Show resolved Hide resolved
Copy link
Member

@kaos kaos left a comment

Choose a reason for hiding this comment

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

Nice.

I'll await a second opinion on this before merging. In the meantime if you'd like to fix the ./pants reference, that'd be great. Thanks. :)

src/python/pants/help/help_formatter.py Outdated Show resolved Hide resolved
Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Lovely! It's neat how few lines this took to do. Thanks!

src/python/pants/help/help_formatter.py Outdated Show resolved Hide resolved
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@Eric-Arellano
Copy link
Contributor

Btw, we're having some issues getting pants_bin() to pass in CI. Feel free to go back to using ./pants while we figure that out - no need to block your PR. This looks great!

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@alexey-tereshenkov-oxb alexey-tereshenkov-oxb marked this pull request as ready for review February 9, 2022 22:39
@Eric-Arellano Eric-Arellano merged commit 0ce449f into pantsbuild:main Feb 10, 2022
@Eric-Arellano
Copy link
Contributor

Thanks for the great contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants