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

main: Various minor tweaks to our main help output #26695

Merged
merged 6 commits into from
Oct 26, 2020

Conversation

apparentlymart
Copy link
Contributor

This is very much a case of my having an extra little bit of time at the end of my week and so using it to tackle a relatively-minor thing that's been kinda bothering me for a while...

This set of commits makes an assortment of different adjustments to code that contributes to the help output that Terraform prints when you just run terraform with no other arguments, aiming to make it more useful to folks who are just getting started, slightly more compact in general, and more consistent in its writing style.

The sum of all of this is the following output:

Usage: terraform [global options] <subcommand> [args]

The available commands for execution are listed below.
The primary workflow commands are given first, followed by
less common or more advanced commands.

Main commands:
  init          Prepare your working directory for other commands
  validate      Check whether the configuration is valid
  plan          Show changes required by the current configuration
  apply         Create or update infrastructure
  destroy       Destroy previously-created infrastructure

All other commands:
  console       Try Terraform expressions at an interactive command prompt
  fmt           Reformat your configuration in the standard style
  force-unlock  Release a stuck lock on the current workspace
  get           Install or upgrade remote Terraform modules
  graph         Generate a Graphviz graph of the steps in an operation
  import        Associate existing infrastructure with a Terraform resource
  login         Obtain and save credentials for a remote host
  logout        Remove locally-stored credentials for a remote host
  output        Show output values from your root module
  providers     Show the providers required for this configuration
  refresh       Update the state to match remote systems
  show          Show the current state or a saved plan
  state         Advanced state management
  taint         Mark a resource instance as not fully functional
  untaint       Remove the 'tainted' state from a resource instance
  version       Show the current Terraform version
  workspace     Workspace management

Global options (use these before the subcommand, if any):
  -chdir=DIR    Switch to a different working directory before executing the
                given subcommand.
  -help         Show this help output, or the help for a specified subcommand.
  -version      An alias for the "version" subcommand.

Some highlights here are:

  • The main workflow commands have greater prominence by separating them from everything else. I chose these as the commands that Terraform users will use routinely as part of their main workflow, whereas the other commands are ones that you're more likely to interact with only if you learn about them from elsewhere as part of dealing with some unusual situation or special use-case.
  • A few more "useless" commands are hidden, where that's defined as commands that exist only to tell a user something is no longer supported, to alias something for backward compatibility, or as an internal implementation detail.
  • The command short descriptions are all written in the imperative mood, except the ones that are just containers for some other nested commands.
  • The weird debug command, which previously did nothing except claim to be a container command even though it had no nested commands, is now removed entirely.

This is just a husk of a container command that has no nested commands
under it, so it isn't serving any purpose.
These are commands that either no longer do anything aside from emitting
an error message or are just backward-compatibility aliases for other
commands.

This generalizes our previous situation where we were specifically
hiding "internal-plugin", and does so in a way that fixes the
long-standing cosmetic bug that the column width in the help output was
chosen based on the hidden command "internal-plugin", which is
unfortunately also the longest command in our command set.
A long time ago we introduced this separation between "common commands"
and "all other commands", but over the intervening years we've not really
done a good job of classifying new commands we've added and so by default
most of them ended up being classified as "common".

In the interests of making this output more useful for those getting
started, this switches the two categories so that "Main commands" is now
the curated list, and "all other commands" is the bucket for everything
else.

The intent here is that the "main commands" are the ones users are likely
to try as part of their initial learning of Terraform, while the other
commands are for less common situations where the user is more likely to
learn about a specific command in some other context, like a tutorial
about a special situation.

The "main commands" are also now ordered by the sequence users will
typically run them in, rather than alphabetical order. That's a subjective
readability tradeoff, but I think as long as the list stays relatively
short (which it should) it's still relatively easy to scan and find a
particular command in the shortlist.
The short description of our commands (as shown in the main help output
from "terraform") was previously very inconsistent, using different
tense/mood for different commands. Some of the commands were also using
some terminology choices inconsistent with how we currently talk about
the related ideas in our documentation.

Here I've tried to add some consistency by first rewriting them all in
the imperative mood (except the ones that just are just subcommand
groupings), and tweaking some of the terminology to hopefully gel better
with how we present similar ideas in our recently-updated docs.

While working on this I inevitably spotted some similar inconsistencies
in the longer-form help output of some of the commands. I've not reviewed
all of these for consistency, but I did update some where the wording
was either left inconsstent with the short form changes I'd made or
where the prose stood out to me as particularly inconsistent with our
current usual documentation language style.

All of this is subjective, so I expect we'll continue to tweak these over
time as we continue to develop our documentation writing style based on
user questions and feedback.
This just reduces the amount of space between different elements on in the
main help output from four columns to two. The main motivation here was
to give some of the longer command descriptions a little more horizontal
breathing room, but subjectively I also find the tighter column gutters
easier to scan. Others may disagree, of course.
My initial motivation here was to update the example output from
Terraform's top-level help list to match recent updates in the layout
and language used.

However, while here I took the opportunity to update some dated language
that was not consistent with our modern documentation writing style,
in particular including a totally unnecessary and potentially-alienating
claim that Terraform is "very easy to use". Our modern writing style
discourages this sort of "boastful" language and encourages us to focus on
the facts at hand.
@codecov
Copy link

codecov bot commented Oct 24, 2020

Codecov Report

Merging #26695 into master will increase coverage by 0.00%.
The diff coverage is 16.30%.

Impacted Files Coverage Δ
command/apply.go 42.38% <0.00%> (-0.21%) ⬇️
command/console.go 37.25% <0.00%> (ø)
command/fmt.go 76.38% <0.00%> (ø)
command/get.go 40.00% <0.00%> (-3.25%) ⬇️
command/graph.go 43.75% <0.00%> (ø)
command/import.go 53.53% <0.00%> (ø)
command/init.go 62.72% <0.00%> (ø)
command/output.go 71.85% <0.00%> (ø)
command/plan.go 41.95% <0.00%> (ø)
command/providers.go 52.43% <0.00%> (ø)
... and 15 more

Copy link
Contributor

@pselle pselle left a comment

Choose a reason for hiding this comment

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

Thank you for picking this up!! Is this a candidate for 0.14 as well? The help there still shows 0.12upgrade etc under "All other commands" and it bothers me and I like that with this it's gone!

@pselle
Copy link
Contributor

pselle commented Oct 26, 2020

Note: Since you remove the debug command, that's technically a breaking change, to consider when considering this for yea/nay on 0.14. You could perhaps separate that change out and keep the rest, to make things backport-able.

@apparentlymart
Copy link
Contributor Author

I had not been planning on backporting this to 0.14; my motivation here was more of a "general clean up on the way to 1.0" sort of thing, and so I don't feel much urgency about it. The various oddities have been there for several years so I feel like a few more months won't hurt. I could probably be persuaded otherwise, though. 😀

While you're right that removing the debug command is technically a breaking change, I don't think it's a breaking change in any useful way because all the terraform debug command used to do was print out help text telling you that it had zero subcommands. 🙃 So I'd be inclined to backport it anyway, if we decide to go that way, but I'd also be okay with carving just that part out of the backport; it's already a separate commit in this patch set anyway, so not too hard to skip.

@apparentlymart apparentlymart merged commit 6a44586 into master Oct 26, 2020
@apparentlymart apparentlymart deleted the f-hide-useless-commands branch October 26, 2020 16:55
@pselle pselle added the 0.14-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged label Oct 28, 2020
@pselle pselle restored the f-hide-useless-commands branch October 28, 2020 14:49
@pselle pselle deleted the f-hide-useless-commands branch October 28, 2020 14:51
@pselle pselle mentioned this pull request Oct 28, 2020
@ghost
Copy link

ghost commented Nov 26, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Nov 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
0.14-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged cli enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants