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

Align the short and long forms into their own columns in the help output #145

Merged
merged 2 commits into from
Apr 26, 2024

Conversation

akhoury6
Copy link
Contributor

This makes displaying a mixed set of parameters cleaner and easier to understand. This is in line with the behavior of common GNU tools such as rsync.

Old way:

Options:
  -i, --init        Creates a skeleton config file in the current working directory
  -v, --verbose     Enables verbose output. Twice will enable very-verbose output (good for logging)
  -y, --yes         Assume 'yes' to all questions for headless execution
  --yaml=<s>        Specify a yaml file to load
  -h, --help        Show this message

New way:

Options:
  -i, --init        Creates a skeleton config file in the current working directory
  -v, --verbose     Enables verbose output. Twice will enable very-verbose output (good for logging)
  -y, --yes         Assume 'yes' to all questions for headless execution
      --yaml=<s>    Specify a yaml file to load
  -h, --help        Show this message

…put.

This makes displaying a mixed set of parameters cleaner and easier to understand. This is in line with the behavior of common GNU tools such as rsync.

Old way:
```
Options:
  -i, --init        Creates a skeleton config file in the current working directory
  -v, --verbose     Enables verbose output. Twice will enable very-verbose output (good for logging)
  -y, --yes         Assume 'yes' to all questions for headless execution
  --yaml=<s>        Specify a yaml file to load
  -h, --help        Show this message
```

New way:
```
Options:
  -i, --init        Creates a skeleton config file in the current working directory
  -v, --verbose     Enables verbose output. Twice will enable very-verbose output (good for logging)
  -y, --yes         Assume 'yes' to all questions for headless execution
      --yaml=<s>    Specify a yaml file to load
  -h, --help        Show this message
```
@akhoury6
Copy link
Contributor Author

Sorry guys, just a few minutes and I'll have the tests sorted out. Slipped by me.

@akhoury6
Copy link
Contributor Author

Done. The remaining tests that are failing seem to be for unrelated issues.

@Fryguy Fryguy assigned Fryguy and unassigned kbrock Apr 24, 2024
@Fryguy
Copy link
Member

Fryguy commented Apr 25, 2024

If there are only long forms, is the whole output kind of indented?

@akhoury6
Copy link
Contributor Author

I can't seem to test that in the real world as there's always a line that says -h, --help Show this message. Unless you can make that line go away I think that situation would never arise.

@Fryguy
Copy link
Member

Fryguy commented Apr 26, 2024

Yeah you're right, at least not without some hackery. A user can override the message for help, and they can override the short form of help, but they can't remove the short form.

@Fryguy Fryguy merged commit 936e463 into ManageIQ:master Apr 26, 2024
11 of 12 checks passed
@akhoury6 akhoury6 deleted the align_output branch April 26, 2024 21:22
Fryguy added a commit that referenced this pull request Nov 11, 2024
Added:
- Align the short and long forms into their own columns in the help output (#145 - thanks akhoury6)
- Add support for DidYouMean when long options are spelled incorrectly (#150 - thanks nanobowers)
- Using `permitted:` restricts the allowed values that a end-user inputs to a pre-defined list (#147 - thanks akhoury6)
- Add exact_match to settings, defaulting to inexact matching (#154 - thanks nanobowers)
- Add setting to disable implicit short options (#155 - thanks nanobowers)
- Add alt longname and multiple char support (#151 - thanks nanobowers)
- Permitted regexp/range support (#158, #159- thanks nanobowers)
- Add some examples (#161 - thanks nanobowers)

Changed:
- Enable frozen_string_literal for future-ruby support (#149, #153  - thanks nanobowers)
- Refactor constraints (#156 - thanks nanobowers)
- Fix assert_raises to assert_raises_errmatch (#160 - thanks nanobowers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants