Skip to content

feat: use --name flag instead of positional arg#963

Merged
craicoverflow merged 8 commits intomainfrom
flag-use-describe
Aug 25, 2021
Merged

feat: use --name flag instead of positional arg#963
craicoverflow merged 8 commits intomainfrom
flag-use-describe

Conversation

@craicoverflow
Copy link
Contributor

@craicoverflow craicoverflow commented Aug 24, 2021

BREAKING CHANGE: This replaces the positional argument in rhoas kafka use, rhoas kafka describe, rhoas kafka delete, rhoas kafka topic describe, rhoas kafka topic update, rhoas kafka topic delete to a --name flag.

Closes #959

Verification Steps

  1. Run rhoas kafka use|describe|delete passing --name.
  2. Run rhoas kafka topic describe --name "<topic-name>"

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation change
  • Other (please specify)

Checklist

  • Documentation added for the feature
  • CI and all relevant tests are passing
  • Code Review completed
  • Verified independently by reviewer

BREAKING CHANGE: This changes the use of a positional argument in commands which "get"
data.
This had a poor user experience as if you do not have completions
enabled it is unclear that a positional can be used.
@craicoverflow craicoverflow changed the title feat(kafka): add --wait flag to perform synchronous Kafka creation (#960) feat: use --name flag instead of positional arg Aug 24, 2021
@craicoverflow craicoverflow marked this pull request as ready for review August 24, 2021 16:34
@craicoverflow
Copy link
Contributor Author

craicoverflow commented Aug 24, 2021

fyi @bhardesty - This will require update to the guides also, which I can start tomorrow.

.golangci.yaml Outdated
- revive
- exportloopref
- godox
# - godox # Disabled as a TODO should not block code from passing
Copy link
Collaborator

@wtrocki wtrocki Aug 24, 2021

Choose a reason for hiding this comment

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

Justification for me to add that was that TODO should be transformed to issue at the time of the PR merge and code should not hold any task tracking elements as that is not the best place to track it.

Ok to keep it. Just giving context so we can completely remove it or keep it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Understood. I think the difficult here is that the TODOs are for code which do not currently exist on the main branch. I will remove the TODOs though as what you say makes sense.

_ = cmd.RegisterFlagCompletionFunc("name", func(cmd *cobra.Command, _ []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return cmdutil.FilterValidTopicNameArgs(f, toComplete)
})
_ = cmd.MarkFlagRequired("name")
Copy link
Collaborator

Choose a reason for hiding this comment

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

[Offtopic] It might be good to have our own helper for that that provides i18n support.
I have been manually validating flags that are required due to lack of i18n support for _ = cmd.MarkFlagRequired("name")

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 don't follow. Something like cmd.MarkFlagRequired(opts.localizer.MustLocalize("flag.id")

@craicoverflow craicoverflow force-pushed the flag-use-describe branch 2 times, most recently from a458d00 to bebcfbb Compare August 25, 2021 09:22
@wtrocki wtrocki self-requested a review August 25, 2021 09:23
@craicoverflow
Copy link
Contributor Author

Ready for review.

@craicoverflow
Copy link
Contributor Author

craicoverflow commented Aug 25, 2021

I actually forgot the topic update command, which I am doing now.

@wtrocki
Copy link
Collaborator

wtrocki commented Aug 25, 2021

LGTM

@craicoverflow craicoverflow merged commit 68a386d into main Aug 25, 2021
@craicoverflow craicoverflow deleted the flag-use-describe branch August 25, 2021 11:00
craicoverflow pushed a commit that referenced this pull request Aug 30, 2021
BREAKING CHANGE: This replaces the positional argument in `rhoas kafka use`, `rhoas kafka describe`, `rhoas kafka delete`, `rhoas kafka topic describe`, `rhoas kafka topic update`, `rhoas kafka topic delete` to a `--name` flag.
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 positional from describe and use commands

3 participants