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

Add additional generic components and helpers #224

Merged
merged 7 commits into from
Feb 4, 2025
Merged

Conversation

anujc25
Copy link
Contributor

@anujc25 anujc25 commented Jan 21, 2025

What this PR does / why we need it

Add additional generic components and helpers functions

  1. Adds Cobra command's Arg, Error and Extend helpers under command package
  2. Adds Emoji and special characters under component/icons package
  3. Adds string and color utils under component/stringutils package
  4. Adds TabWriter component under component/tabwriter package

Which issue(s) this PR fixes

Fixes #

Describe testing done for PR

Release note

Add Cobra command's `Arg`, `Error` and `Extend` helpers, Icons, Color printer and TabWriter component

Additional information

Special notes for your reviewer

command/extend.go Outdated Show resolved Hide resolved
@anujc25 anujc25 marked this pull request as ready for review January 23, 2025 17:55
@anujc25 anujc25 requested a review from a team as a code owner January 23, 2025 17:55
command/arguments.go Outdated Show resolved Hide resolved
Comment on lines 13 to 20
var (
FaintColor = color.New(color.Faint)
InfoColor = color.New(color.FgCyan)
SuccessColor = color.New(color.FgGreen)
WarnColor = color.New(color.FgYellow)
ErrorColor = color.New(color.FgRed)
BoldColor = color.New(color.Bold)
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Noticed that we already have compnent/colorable-tty.go which holds similar color specific helpers. Check to see how we can combine both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have deprecated some of the string helpers in colorable-tty.go and created a new package stringutils which includes all the string specific utils functions along with color specific helpers.

component/characters/icon.go Outdated Show resolved Hide resolved
Copy link
Contributor

@marckhouzam marckhouzam left a comment

Choose a reason for hiding this comment

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

Nice stuff.
Thanks for the effort!

component/characters/icon.go Outdated Show resolved Hide resolved
component/characters/spaces.go Outdated Show resolved Hide resolved
component/characters/spaces.go Outdated Show resolved Hide resolved
component/stringutils/color.go Outdated Show resolved Hide resolved
component/colorable-tty.go Outdated Show resolved Hide resolved
component/tabwriter/internal/tabwriter.go Show resolved Hide resolved
component/tabwriter/internal/tabwriter.go Outdated Show resolved Hide resolved
command/arguments.go Show resolved Hide resolved
command/extend.go Outdated Show resolved Hide resolved
command/arguments.go Outdated Show resolved Hide resolved
@anujc25 anujc25 force-pushed the add-plugin-helper branch 2 times, most recently from 3fc5814 to 4fae43f Compare February 4, 2025 19:24
component/README.md Outdated Show resolved Hide resolved
component/terminal.go Outdated Show resolved Hide resolved
Copy link
Contributor

@marckhouzam marckhouzam left a comment

Choose a reason for hiding this comment

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

LGTM
Very nice.
If there are things to tweak when we start using this change in an existing plugin, we can fix in another PR.

@anujc25 anujc25 merged commit 4235cde into main Feb 4, 2025
4 checks passed
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