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 commands and CLI options #110

Merged
merged 4 commits into from
Sep 5, 2023
Merged

Refactor commands and CLI options #110

merged 4 commits into from
Sep 5, 2023

Conversation

puerco
Copy link
Member

@puerco puerco commented Aug 18, 2023

This PR refactors the vexctl commands and CLI options for better reuse across the CLI in preparation for new subcommands that are coming really soon.

Note: Requires #92 and a rebase (merged)

Signed-off-by: Adolfo García Veytia (Puerco) [email protected]

@puerco
Copy link
Member Author

puerco commented Aug 30, 2023

Rebased and ready to go 🚀

internal/cmd/create.go Outdated Show resolved Hide resolved
Comment on lines +93 to +103
if opts.Product != "" && opts.Product != args[i] {
return errors.New("product can only be specified once")
}
opts.Product = args[i]
case 1:
if opts.Vulnerability != "" && opts.Vulnerability != args[i] {
return errors.New("vulnerability can only be specified once")
}
opts.Vulnerability = args[i]
case 2:
if opts.Status != "" && opts.Status != args[i] {
return errors.New("status can only be specified once")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we ask for these values both as flags and as positional args? I'm wondering if that ambiguity hinders the clarity of the CLI UX a bit 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

This has its origins back when vexctl supported more than one product on create, etc. You can quickly define one of them using the params or have more control with the flags. We could change it later if it makes more sense but it is a breaking change and we need to deprecate one of the mechanisms and notify users.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, thanks for the context. This certainly doesn't block this PR. It might be worth thinking about a UX "audit" at some point in the future and deciding what deprecations make sense as you think about what your vision is for the CLI.

internal/cmd/merge.go Outdated Show resolved Hide resolved
internal/cmd/options.go Show resolved Hide resolved
internal/cmd/options.go Outdated Show resolved Hide resolved
internal/cmd/options.go Outdated Show resolved Hide resolved
internal/cmd/options.go Outdated Show resolved Hide resolved
internal/cmd/options.go Show resolved Hide resolved
internal/cmd/options.go Show resolved Hide resolved
internal/cmd/options.go Show resolved Hide resolved
internal/cmd/options.go Outdated Show resolved Hide resolved
internal/cmd/options.go Show resolved Hide resolved
This commit refactors the vexctl commands and commits to enable better reuse
in preparation for new vexctl subcommands that are coming really soon.

Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Copy link
Contributor

@luhring luhring left a comment

Choose a reason for hiding this comment

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

👍

@puerco puerco merged commit 0473d31 into openvex:main Sep 5, 2023
@puerco puerco deleted the add branch September 5, 2023 22:44
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.

2 participants