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

Fix alignment with available commands #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mikelorant
Copy link

When upgrading the Color package from v1.15.0 to v1.16.0, the list of available commands becomes incorrectly aligned:

Available Commands:

  completion Generate the autocompletion script for the specified shell
  help      Help about any command
  test      Test command for clarity

This was related to an issue where reset codes were not correctly set. The fix, which added extra reset codes, increased the length of the string (which includes the ANSI codes) causing the amount of padding to be insufficient.

This change, which upgrades the Color package to v1.16.0, also increass the padding to account for the additional ANSI reset codes that are now part of the string. This restores the text alignment to how it was previously displayed.

Unit tests also needed to be updated to account for this change and are passing successfully.

The Color package had updated its dependencies which has caused the changes in go.mod to impact more than itself.

Fixes: #4

When upgrading the Color package from `v1.15.0` to `v1.16.0`, the list
of available commands becomes incorrectly aligned:

```text
Available Commands:

  completion Generate the autocompletion script for the specified shell
  help      Help about any command
  test      Test command for clarity
```

This was related to an [issue][1] where reset codes were not correctly
set. The [fix][2], which added extra reset codes, increased the length
of the string (which includes the ANSI codes) causing the amount of
padding to be insufficient.

This change, which upgrades the Color package to `v1.16.0`, also
increass the padding to account for the additional ANSI reset codes
that are now part of the string. This restores the text alignment to
how it was previously displayed.

Unit tests also needed to be updated to account for this change and are
passing successfully.

The Color package had updated its dependencies which has caused the
changes in `go.mod` to impact more than itself.

Fixes: ivanpirog#4

[1]: fatih/color#206
[2]: fatih/color#210

Signed-off-by: Michael Lorant <michael.lorant@nine.com.au>
@mikelorant
Copy link
Author

@ivanpirog Let me know if this meets your requirements for fixing this issue.

mikelorant added a commit to mikelorant/committed that referenced this pull request Jun 1, 2024
Upgrade dependencies to latest releases. As part of this upgrade there
were two packages worth mentioning.

The `bubbles` package was previously using a modified fork that added
support for [textarea multiline placeholders][1]. This change has now
been merged upstream and there is no longer a need to rely on the
custom version.

The `coloredcobra` package which provides the colours for the CLI help
text was impacted by the upgrade of the `color` package. A [fix][2] has
been applied that currently only exists in a forked version. This is
necessary until the upstream merges the pull reques to fix this
problem.

[1]: charmbracelet/bubbles#302
[2]: ivanpirog/coloredcobra#5
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.

List of available commands is incorrectly aligned
1 participant