Skip to content

refactor: add root package for Cobra commands#825

Merged
qweeah merged 6 commits into
oras-project:mainfrom
qweeah:refactor-main
Mar 30, 2023
Merged

refactor: add root package for Cobra commands#825
qweeah merged 6 commits into
oras-project:mainfrom
qweeah:refactor-main

Conversation

@qweeah

@qweeah qweeah commented Feb 20, 2023

Copy link
Copy Markdown
Contributor

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

codecov-commenter commented Feb 20, 2023

Copy link
Copy Markdown

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.

Comment thread cmd/oras/cmd/example_test.go Outdated
@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 requested a review from TerryHowe as a code owner February 21, 2023 03:01
@qweeah qweeah marked this pull request as draft February 21, 2023 03:02
@qweeah

qweeah commented Feb 21, 2023

Copy link
Copy Markdown
Contributor Author

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
@qweeah qweeah removed request for deitch and jdolitsky March 23, 2023 11:17

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

qweeah added 5 commits March 26, 2023 13:10
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

qweeah commented Mar 28, 2023

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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

qweeah commented Mar 30, 2023

Copy link
Copy Markdown
Contributor Author

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.

Comment thread cmd/oras/main.go Outdated
@shizhMSFT

Copy link
Copy Markdown
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>

@shizhMSFT shizhMSFT left a comment

Copy link
Copy Markdown
Contributor

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