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

Migrate to tableprinter from go-gh #6346

Merged
merged 7 commits into from Oct 17, 2022
Merged

Migrate to tableprinter from go-gh #6346

merged 7 commits into from Oct 17, 2022

Conversation

mislav
Copy link
Member

@mislav mislav commented Sep 26, 2022

Tableprinter now lives as a go-gh package with a nicer API. This migrates to using it behind the original, legacy API.

TODO

  • Deprecate the legacy API
  • Make it easier to generate a go-gh tableprinter from IOStreams

@mislav
Copy link
Member Author

mislav commented Oct 10, 2022

The new internal/tableprinter package is live. It wraps pkg/tableprinter from go-gh library and adds the following methods:

  • HeaderRow() - adds the header row only in TTY mode
  • AddTimeField() - formats a time value using relative time ago in TTY mode

The utils tableprinter is now deprecated.

@mislav mislav marked this pull request as ready for review Oct 10, 2022
@mislav mislav requested review from a team as code owners Oct 10, 2022
@mislav mislav requested review from samcoe (assigned from cli/code-reviewers) and removed request for a team Oct 10, 2022
@cliAutomation cliAutomation added this to Needs review 🤔 in The GitHub CLI Oct 10, 2022
@@ -86,6 +86,7 @@ func (a *App) List(ctx context.Context, opts *listOptions, exporter cmdutil.Expo
return cmdutil.NewNoResultsError("no codespaces found")
}

//nolint:staticcheck // SA1019: utils.NewTablePrinter is deprecated: use internal/tableprinter
Copy link
Member

@josebalius josebalius Oct 10, 2022

Choose a reason for hiding this comment

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

Should the team create an issue to migrate these, or are you planning to tackle this as part of some other work?

cc @cmbrose (not sure who's "owning" cs CLI these days)

Copy link
Member Author

@mislav mislav Oct 10, 2022

Choose a reason for hiding this comment

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

Good question. Codespace team: feel free to ignore this. It's a codebase-wide deprecation and doesn't need to be immediately addressed specifically for codespaces. The deprecation is mostly to avoid new code importing the legacy utils package.

Copy link
Member

@samcoe samcoe left a comment

The new internal tableprinter package looks great. Just left one comment about maintaining current functionality in it.

utils/table_printer.go Show resolved Hide resolved
samcoe
samcoe approved these changes Oct 13, 2022
The GitHub CLI automation moved this from Needs review 🤔 to Needs to be merged 🎉 Oct 13, 2022
@mislav mislav merged commit 3fe5026 into trunk Oct 17, 2022
10 checks passed
The GitHub CLI automation moved this from Needs to be merged 🎉 to Pending Release 🥚 Oct 17, 2022
@mislav mislav deleted the table-printer-new branch Oct 17, 2022
@github-actions github-actions bot moved this from Pending Release 🥚 to Done 💤 in The GitHub CLI Oct 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
The GitHub CLI
  
Done 💤
Development

Successfully merging this pull request may close these issues.

None yet

3 participants