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

refactor: add root package for Cobra commands #825

Merged
merged 6 commits into from
Mar 30, 2023

Conversation

qweeah
Copy link
Contributor

@qweeah qweeah commented Feb 20, 2023

This PR

  • Adds a new root command type to align with Cobra good practices.
    - Adds a root context so all subcommand execution can use. Removing this, will add changes in another PR to make review easier
    - Adds a new godoc runnable example for go scripting. Removing this from this PR since it causes coverage drop instantly. To fix the coverage drop, I will propose another change by utilizing instrumented build.

Related to #824, resolves #807

@codecov-commenter
Copy link

codecov-commenter commented Feb 20, 2023

Codecov Report

Merging #825 (3fbf582) into main (67dca8e) will not change coverage.
The diff coverage is n/a.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@           Coverage Diff           @@
##             main     #825   +/-   ##
=======================================
  Coverage   67.79%   67.79%           
=======================================
  Files          22       22           
  Lines         860      860           
=======================================
  Hits          583      583           
  Misses        232      232           
  Partials       45       45           
Impacted Files Coverage Δ
internal/repository/repository.go 100.00% <ø> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

cmd/oras/cmd/example_test.go Outdated Show resolved Hide resolved
@qweeah qweeah changed the title refactor: move commands out of main package refactor: add root command with properly context setting and runnable scripting examples Feb 20, 2023
@qweeah qweeah marked this pull request as draft February 21, 2023 03:02
@qweeah
Copy link
Contributor Author

qweeah commented Feb 21, 2023

Looks like the ignore settings are not working, need to figure out why, reset to draft.

@qweeah qweeah changed the title refactor: add root command with properly context setting and runnable scripting examples refactor: add root package for Cobra commands Mar 23, 2023
@qweeah qweeah marked this pull request as ready for review March 23, 2023 02:15
@qweeah qweeah mentioned this pull request Mar 23, 2023
4 tasks
Copy link
Member

@TerryHowe TerryHowe left a comment

Choose a reason for hiding this comment

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

/lgtm

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
@qweeah
Copy link
Contributor Author

qweeah commented Mar 28, 2023

Let's It's better to hold the merging of this PR before module name changed from oras.land to github.com

@TerryHowe
Copy link
Member

Let's hold the merging of this PR before module name changed from oras.land to github.com

Not sure why we'd hold this for that.

@qweeah
Copy link
Contributor Author

qweeah commented Mar 30, 2023

Let's hold the merging of this PR before module name changed from oras.land to github.com

Not sure why we'd hold this for that.

If this PR is merged, there might be potential users who write go scripts based on oras.land/oras/cmd/oras/rootand make this repo subject to the module name change.

cmd/oras/main.go Outdated Show resolved Hide resolved
@shizhMSFT
Copy link
Contributor

If this PR is merged, there might be potential users who write go scripts based on oras.land/oras/cmd/oras/rootand make this repo subject to the module name change.

It is OK as long as we change the module name before the next release.

Signed-off-by: Billy Zha <jinzha1@microsoft.com>
Copy link
Contributor

@shizhMSFT shizhMSFT left a comment

Choose a reason for hiding this comment

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

LGTM

@qweeah qweeah merged commit 07a754e into oras-project:main Mar 30, 2023
shizhMSFT pushed a commit to shizhMSFT/oras that referenced this pull request Aug 3, 2023
Signed-off-by: Billy Zha <jinzha1@microsoft.com>
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.

Make public command level methods so users can script in go
4 participants