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

Allow passing numeric or string resource ID in new CLI #71

Closed
spetz opened this issue Sep 21, 2023 · 0 comments · Fixed by #79
Closed

Allow passing numeric or string resource ID in new CLI #71

spetz opened this issue Sep 21, 2023 · 0 comments · Fixed by #79
Assignees
Labels
improvement A change that improves our (or users) QoL tui Command line interface (iggy-cmd/iggy-cli) related change

Comments

@spetz
Copy link
Collaborator

spetz commented Sep 21, 2023

In order to make a new CLI compatible with existing API, we could allow the user to provide either numeric ID (e.g. Stream = 1), or string ID (e.g. Topic = "orders") for the resources such as stream, topic and user.

For example, the SDK command looks like this:

pub struct DeleteTopic {
    pub stream_id: Identifier,
    pub topic_id: Identifier,
} 

And the CLI command could either use the same Identifier wrapper or just make use of String? to work similarly:

pub(crate) struct TopicDelete {
    stream_id: u32,
    topic_id: u32,
}

The only exceptions are CreateStream and CreateTopic commands (in the latter, you can use the Identifier for stream_id only).

@spetz spetz added improvement A change that improves our (or users) QoL tui Command line interface (iggy-cmd/iggy-cli) related change labels Sep 21, 2023
BartoszCiesla added a commit that referenced this issue Sep 22, 2023
Replace u32 with Identifier struct in order to enable user to use either
stream / topic ID (numerical) or name in command line operations like
update, delete, get, list (topics). This fix #71
@spetz spetz closed this as completed in #79 Sep 23, 2023
spetz pushed a commit that referenced this issue Sep 23, 2023
Replace u32 with Identifier struct in order to enable user to use either
stream / topic ID (numerical) or name in command line operations like
update, delete, get, list (topics). This fix #71
spetz pushed a commit that referenced this issue Sep 23, 2023
* Use Identifier struct for stream and topic identification

Replace u32 with Identifier struct in order to enable user to use either
stream / topic ID (numerical) or name in command line operations like
update, delete, get, list (topics). This fix #71

* Extend help for each command with examples

Add to each command long help with additional information and section
with examples of command usage. Remove debug print for topic get
command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement A change that improves our (or users) QoL tui Command line interface (iggy-cmd/iggy-cli) related change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants