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

feat: aod cli do/cleanup command #52

Merged
merged 2 commits into from
Jun 26, 2023
Merged

feat: aod cli do/cleanup command #52

merged 2 commits into from
Jun 26, 2023

Conversation

sqin2019
Copy link
Contributor

No description provided.

pkg/cli/cli_handle.go Show resolved Hide resolved
pkg/cli/root.go Show resolved Hide resolved
pkg/cli/cli_handle.go Outdated Show resolved Hide resolved
@sqin2019 sqin2019 merged commit dc4994f into main Jun 26, 2023
@sqin2019 sqin2019 deleted the sqin/clicli branch June 26, 2023 20:09
Comment on lines +38 to +39
// Run Cleanup instead of Do if true.
Cleanup bool
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I don't think this is the correct architecture. We should have a "do" command and a "cleanup" command. Branching logic based off of a boolean feels like a design smell.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this case, what about make it a flag. so the commands are like do: aod cli handle -path <path/to/file.yaml>, cleanup: aod cli handle -path <path/to/file.yaml> -cleanup

Copy link

@capri-xiyue capri-xiyue Jun 27, 2023

Choose a reason for hiding this comment

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

We discussed similar issues in #52 (comment). Maybe it is still worthwhile to have a wrapper layer like "do": &CLIDoCommand{CLIHandleCommand{dofunc(ctx, *v1alpha1.CLIRequest) error}}, "cleanup": &CLICleanupCommand{CLIHandleCommand{cleanupfunc(ctx, *v1alpha1.CLIRequest) error}} now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this might be better in fact: #55, thank you both! Let me know what you think.

@sqin2019 sqin2019 mentioned this pull request Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants