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 interactive repository edit functionality #4895

Merged
merged 15 commits into from Mar 14, 2022

Conversation

Copy link
Contributor

@g14a g14a commented Dec 12, 2021

This PR adds functionality to interactively edit repository settings. This is a continuation of #3882 and follows the design and the feedback I've previously gotten in the same.

It is still a work in progress as I need to add test cases.

Ref: #3882 and #4318

@g14a g14a requested a review from as a code owner Dec 12, 2021
@g14a g14a requested review from samcoe (assigned from cli/code-reviewers) and removed request for Dec 12, 2021
@g14a g14a changed the title add interactive repository edit functionality. Tests yet to be added. add interactive repository edit functionality Dec 12, 2021
@cliAutomation cliAutomation added the external label Dec 12, 2021
@cliAutomation cliAutomation added this to Needs review 🤔 in The GitHub CLI Dec 12, 2021
@g14a
Copy link
Contributor Author

@g14a g14a commented Dec 22, 2021

@samcoe This is ready for review. Would like some feedback on how I achieved this :)

Copy link
Member

@mislav mislav left a comment

This looks good so far! Note that our team is on holiday until January, so you will only get a thorough review then.

Two things stand out to me here:

  • The defaults for prompts are hardcoded: the default for Visibility is "public" and the default for most booleans is false. The defaults should be instead informed by the repository being edited.
  • There are simply too many serial prompts if I wanted to just edit a single field interactively. The interactive mode could thus be exhausting to use. Did you consider taking the approach of gh issue edit where the first prompt is selecting the fields you actually want to edit?

@g14a
Copy link
Contributor Author

@g14a g14a commented Dec 22, 2021

This looks good so far! Note that our team is on holiday until January, so you will only get a thorough review then.

Two things stand out to me here:

* The defaults for prompts are hardcoded: the default for Visibility is "public" and the default for most booleans is `false`. The defaults should be instead informed by the repository being edited.

* There are simply too many serial prompts if I wanted to just edit a single field interactively. The interactive mode could thus be exhausting to use. Did you consider taking the approach of `gh issue edit` where the first prompt is selecting the fields you actually want to edit?

Thank you for the feedback @mislav, the gh issue edit makes sense and would be a lot easier for the user too. I'll get back with changes wherever needed. Happy Holidays! 🥳

@g14a
Copy link
Contributor Author

@g14a g14a commented Jan 8, 2022

@mislav I've made the required changes and modified tests as well. Please do let me know if we can make this better :)

@mislav mislav self-assigned this Jan 12, 2022
@g14a
Copy link
Contributor Author

@g14a g14a commented Jan 31, 2022

@mislav just wanted to know if there are any more changes needed in this :)

@mislav mislav assigned samcoe and unassigned mislav Feb 9, 2022
@g14a
Copy link
Contributor Author

@g14a g14a commented Mar 3, 2022

@samcoe @mislav is there any more progress needed on this?

Copy link
Member

@samcoe samcoe left a comment

@g14a Sorry for the long wait on review. This is coming along nicely. Let me know if you have any questions about my comments.

pkg/cmd/repo/edit/edit.go Show resolved Hide resolved
pkg/cmd/repo/edit/edit.go Outdated Show resolved Hide resolved
pkg/cmd/repo/edit/edit.go Outdated Show resolved Hide resolved
pkg/cmd/repo/edit/edit.go Outdated Show resolved Hide resolved
Name: "addTopics",
Prompt: &survey.Input{
Message: "Add topics?(csv format)",
Default: defaultTopics,
Copy link
Member

@samcoe samcoe Mar 4, 2022

Choose a reason for hiding this comment

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

Seems like this should be a blank string?

Copy link
Contributor Author

@g14a g14a Mar 4, 2022

Choose a reason for hiding this comment

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

Here we show the user his existing topics so that he needn't add them again, and thereby can delete what he doesn't need. Just like how the platform does on the UI.

@g14a
Copy link
Contributor Author

@g14a g14a commented Mar 4, 2022

@samcoe responded to some comments and worked on some comment feedback.

Copy link
Member

@samcoe samcoe left a comment

@g14a Thanks for making the requested changes. I went ahead and pushed some small simplifications and polish 💅

@samcoe samcoe requested a review from mislav Mar 7, 2022
@g14a
Copy link
Contributor Author

@g14a g14a commented Mar 7, 2022

@samcoe Thank you so much :)

Copy link
Member

@mislav mislav left a comment

This looks good! Thanks for the hard work. Minor points remain

"github.com/cli/cli/v2/pkg/set"
"github.com/spf13/cobra"
"golang.org/x/sync/errgroup"
)

const (
Copy link
Member

@mislav mislav Mar 14, 2022

Choose a reason for hiding this comment

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

Love these consts 👍

pkg/cmd/repo/edit/edit.go Outdated Show resolved Hide resolved
pkg/cmd/repo/edit/edit.go Outdated Show resolved Hide resolved
pkg/cmd/repo/edit/edit.go Outdated Show resolved Hide resolved
The GitHub CLI automation moved this from Needs review 🤔 to Needs to be merged 🎉 Mar 14, 2022
pkg/cmd/repo/edit/edit.go Outdated Show resolved Hide resolved
@samcoe samcoe enabled auto-merge (squash) Mar 14, 2022
@samcoe samcoe merged commit 83a6ccc into cli:trunk Mar 14, 2022
6 checks passed
The GitHub CLI automation moved this from Needs to be merged 🎉 to Pending Release 🥚 Mar 14, 2022
@github-actions github-actions bot moved this from Pending Release 🥚 to Done 💤 in The GitHub CLI Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external
Projects
The GitHub CLI
  
Done 💤
Development

Successfully merging this pull request may close these issues.

None yet

4 participants