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

Remove domains #12

Merged
merged 5 commits into from
Mar 26, 2020
Merged

Remove domains #12

merged 5 commits into from
Mar 26, 2020

Conversation

pacodes
Copy link
Contributor

@pacodes pacodes commented Mar 24, 2020

Closes #5 added remove domains subcommand

Copy link
Owner

@guumaster guumaster left a comment

Choose a reason for hiding this comment

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

Thanks for your PR. Please check the comments

cmd/remove.go Outdated
removeCmd.Flags().Bool("all", false, "Remove all profiles")

removeCmd.AddCommand(removeDomainsCmd)
removeDomainsCmd.Flags().Bool("all", false, "Remove all domains")
Copy link
Owner

Choose a reason for hiding this comment

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

If you remove all domains from a profile, you are effectively removing the profile. I think this all flag is not needed here.

cmd/remove.go Outdated
@@ -36,7 +36,10 @@ use 'hosts disable' instead.
profile, _ := cmd.Flags().GetString("profile")
dst, _ := cmd.Flags().GetString("host-file")

err := host.Remove(dst, profile)
err := host.RemoveProfile(&host.RemoveProfileOptions{
Copy link
Owner

Choose a reason for hiding this comment

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

I prefer to have positional parameters in this case. I use to add struct options only for optional params or params with useful defaults. But in this case, all are required.

Suggested change
err := host.RemoveProfile(&host.RemoveProfileOptions{
err := host.RemoveProfile(dst, profile)

cmd/remove.go Outdated
profile, _ := cmd.Flags().GetString("profile")
dst, _ := cmd.Flags().GetString("host-file")

err := host.RemoveDomains(&host.RemoveDomainsOptions{
Copy link
Owner

Choose a reason for hiding this comment

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

Same comment as RemoveProfile above

Suggested change
err := host.RemoveDomains(&host.RemoveDomainsOptions{
err := host.RemoveDomains(dst, profile, domains)

@pacodes pacodes requested a review from guumaster March 25, 2020 21:52
@guumaster guumaster merged commit 20c4a5b into guumaster:master Mar 26, 2020
@guumaster
Copy link
Owner

🎉 thanks @pacodes !

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.

Remove domains command
2 participants