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

Reorder cabal help commands #8433

Merged
merged 1 commit into from
Sep 21, 2022
Merged

Reorder cabal help commands #8433

merged 1 commit into from
Sep 21, 2022

Conversation

ffaf1
Copy link
Collaborator

@ffaf1 ffaf1 commented Aug 29, 2022

I reordered CLI help commands to match #8332, but I get some extra whitespace. Any idea why?

Commands:
 [global]
  user-config            Display and update the user's global cabal configuration.
  help                   Help about commands.

 [package database]
  update                 Updates list of known packages.
  list                   List packages matching a search string.
  info                   Display detailed information about a particular package.

 [initialization and download]
  init                   Create a new cabal package.
  fetch                  Downloads packages for later installation.
  get                    Download/Extract a package's source code (repository).

 [project configuration]
  configure              Add extra project configuration.
  freeze                 Freeze dependencies.
  gen-bounds             Generate dependency bounds.
  outdated               Check for outdated dependencies.

 [project building and installing]
  build                  Compile targets within the project.
  install                Install packages.
  haddock                Build Haddock documentation.
  haddock-project        Generate Haddocks HTML documentation for the cabal project.
  clean                  Clean the package store and remove temporary files.

 [running and testing]
  list-bin               List the path to a single executable.
  repl                   Open an interactive session for the given component.
  run                    Run an executable.
  bench                  Run benchmarks.
  test                   Run test-suites.
  exec                   Give a command access to the store.

 [sanity checks and shipping]
  check                  Check the package for common mistakes.
  sdist                  Generate a source distribution file (.tar.gz).
  upload                 Uploads source packages or documentation to Hackage.
  report                 Upload build reports to a remote server.

 [deprecated]
  unpack                 Deprecated alias for 'get'.
  hscolour               Generate HsColour colourised code, in HTML format.

 [new-style projects (forwards-compatible aliases)]
  v2-build               Compile targets within the project.
  v2-configure           Add extra project configuration.
  v2-repl                Open an interactive session for the given component.
  v2-run                 Run an executable.
  v2-test                Run test-suites.
  v2-bench               Run benchmarks.
  v2-freeze              Freeze dependencies.
  v2-haddock             Build Haddock documentation.
  v2-exec                Give a command access to the store.
  v2-update              Updates list of known packages.
  v2-install             Install packages.
  v2-clean               Clean the package store and remove temporary files.
  v2-sdist               Generate a source distribution file (.tar.gz).

 [legacy command aliases]
  v1-build               Compile all/specific components.
  v1-configure           Prepare to build the package.
  v1-repl                Open an interpreter session for the given component.
  v1-run                 Builds and runs an executable.
  v1-test                Run all/specific tests in the test suite.
  v1-bench               Run all/specific benchmarks.
  v1-freeze              Freeze dependencies.
  v1-haddock             Generate Haddock HTML documentation.


  v1-install             Install packages.
  v1-clean               Clean up after a build.


  v1-copy                Copy the files of all/specific components to install locations.
  v1-register            Register this package with the compiler.
  v1-reconfigure         Reconfigure the package if necessary.

 [other]
  haddock-project        Generate Haddocks HTML documentation for the cabal project.
  new-haddock-project    Generate Haddocks HTML documentation for the cabal project.
  v2-haddock-project     Generate Haddocks HTML documentation for the cabal project.

(mind the extra whitespace around v1-install and v1-clean.


Please include the following checklist in your PR:

Please also shortly describe how you tested your change. Bonus points for added tests!

@ffaf1 ffaf1 added the attention: needs-help Help wanted with this issue/PR label Aug 31, 2022
@ulysses4ever
Copy link
Collaborator

I noticed that the extra space around v1-clean/v1-install appeared somewhere between cabal-install 3.4 and 3.6. At least, this is not a fault of this PR and I think it can be merged as is.

@ulysses4ever
Copy link
Collaborator

More precisely, 3.4 introduced an extra space after v1-clean only. 3.6 added one before v1-install. And 3.2 was perfectly fine.

@ulysses4ever
Copy link
Collaborator

Okay, here's the deal with the spaces. Compare the output:

...
  v1-haddock             Generate Haddock HTML documentation.


  v1-install             Install packages.
  v1-clean               Clean up after a build.


  v1-copy                Copy the files of all/specific components to install locations.
...

and the corresponding code:

, addCmd "v1-haddock"
, addCmd "v1-exec"
, addCmd "v1-update"
, addCmd "v1-install"
, addCmd "v1-clean"
, addCmd "v1-sdist"
, addCmd "v1-doctest"
, addCmd "v1-copy"

Copy and haddock are printed. Install and clean too. But all other commands (evec, update, sdist, doctest), apparently, were removed, and addCmd prints an empty string for unknown commands (a terrible idea, of course).

Note for future us: when removing another command, grep through the source before committing.

@ffaf1
Copy link
Collaborator Author

ffaf1 commented Sep 2, 2022

Excellent. New output:

Commands:
 [global]
  user-config            Display and update the user's global cabal configuration.
  help                   Help about commands.

 [package database]
  update                 Updates list of known packages.
  list                   List packages matching a search string.
  info                   Display detailed information about a particular package.

 [initialization and download]
  init                   Create a new cabal package.
  fetch                  Downloads packages for later installation.
  get                    Download/Extract a package's source code (repository).

 [project configuration]
  configure              Add extra project configuration.
  freeze                 Freeze dependencies.
  gen-bounds             Generate dependency bounds.
  outdated               Check for outdated dependencies.

 [project building and installing]
  build                  Compile targets within the project.
  install                Install packages.
  haddock                Build Haddock documentation.
  haddock-project        Generate Haddocks HTML documentation for the cabal project.
  clean                  Clean the package store and remove temporary files.

 [running and testing]
  list-bin               List the path to a single executable.
  repl                   Open an interactive session for the given component.
  run                    Run an executable.
  bench                  Run benchmarks.
  test                   Run test-suites.
  exec                   Give a command access to the store.

 [sanity checks and shipping]
  check                  Check the package for common mistakes.
  sdist                  Generate a source distribution file (.tar.gz).
  upload                 Uploads source packages or documentation to Hackage.
  report                 Upload build reports to a remote server.

 [deprecated]
  unpack                 Deprecated alias for 'get'.
  hscolour               Generate HsColour colourised code, in HTML format.

 [new-style projects (forwards-compatible aliases)]
  v2-build               Compile targets within the project.
  v2-configure           Add extra project configuration.
  v2-repl                Open an interactive session for the given component.
  v2-run                 Run an executable.
  v2-test                Run test-suites.
  v2-bench               Run benchmarks.
  v2-freeze              Freeze dependencies.
  v2-haddock             Build Haddock documentation.
  v2-exec                Give a command access to the store.
  v2-update              Updates list of known packages.
  v2-install             Install packages.
  v2-clean               Clean the package store and remove temporary files.
  v2-sdist               Generate a source distribution file (.tar.gz).

 [legacy command aliases]
  v1-build               Compile all/specific components.
  v1-configure           Prepare to build the package.
  v1-repl                Open an interpreter session for the given component.
  v1-run                 Builds and runs an executable.
  v1-test                Run all/specific tests in the test suite.
  v1-bench               Run all/specific benchmarks.
  v1-freeze              Freeze dependencies.
  v1-haddock             Generate Haddock HTML documentation.
  v1-install             Install packages.
  v1-clean               Clean up after a build.
  v1-copy                Copy the files of all/specific components to install locations.
  v1-register            Register this package with the compiler.
  v1-reconfigure         Reconfigure the package if necessary.

 [other]
  haddock-project        Generate Haddocks HTML documentation for the cabal project.
  new-haddock-project    Generate Haddocks HTML documentation for the cabal project.
  v2-haddock-project     Generate Haddocks HTML documentation for the cabal project.

@ffaf1 ffaf1 removed the attention: needs-help Help wanted with this issue/PR label Sep 2, 2022
@ffaf1 ffaf1 marked this pull request as ready for review September 2, 2022 07:10
@ulysses4ever
Copy link
Collaborator

LGTM. If you feel brave, it'd be nice to do something about addCmd so that it properly fails when passed an unknown command and therefore save on debugging in the future. The current behavior is pretty bad imo. It could go into a separate ticket of course, but I don't feel energy to open one currently.

@ffaf1
Copy link
Collaborator Author

ffaf1 commented Sep 3, 2022

Separate ticket it will be, so we can get some feedback on how big of a failure (assert? warning?) it should be.

Copy link
Member

@Mikolaj Mikolaj left a comment

Choose a reason for hiding this comment

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

Well done.

@ffaf1 ffaf1 added merge me Tell Mergify Bot to merge and removed attention: needs-review labels Sep 19, 2022
@mergify mergify bot added the merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days label Sep 21, 2022
@mergify mergify bot merged commit f3b5de9 into haskell:master Sep 21, 2022
@ffaf1 ffaf1 deleted the reorder-cli-help branch September 21, 2022 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days merge me Tell Mergify Bot to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants