-
-
Notifications
You must be signed in to change notification settings - Fork 562
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
Parse ChangeHistory command-line arguments #8365
Conversation
Hi @Nathy-bajo I am going to review the PR today. In the meantime can you please have a look at the list of checks in the PR description? In particular you need to format your commits and open a separate PR to be added to the contributors file. Thanks. |
Alright, I will do just that. |
@etorreborre Please can you review this PR |
Hi @Nathy-bajo, I think we can do something simple by leveraging some existing code without a new crate. #[arg(long, value_name = "ACCOUNT_AUTHORITY_CHANGE_HISTORY", default_value = None, value_parser = ChangeHistory::import_from_string)]
account_authority: Option<ChangeHistory>, A bit of massaging for error types could be necessary but otherwise this should work. |
Hello @etorreborre 😄 |
Hi @Nathy-bajo, that looks good, can you please rebase to fix the conflict? |
I have rebased it. |
Hi @Nathy-bajo. We don't accept merge commits on our branches, only rebasing.
|
Hello @etorreborre. Hope you're having a good day😄 |
@Nathy-bajo can you please have a look at the failed jobs? For example you will have to get rid of the merge commit 0c026b8 (one way to do this is to recreate your branch entirely and force-push it). |
Hello @etorreborre |
Hello @etorreborre |
Let me try to fix this PR. |
@Nathy-bajo we're getting there! |
Hello @etorreborre 😄 |
Current behavior
Currently, the ockam_command has multiple places where Identity change history is accepted as a hex-encoded string. This approach lacks type safety and does not validate or decode the input into a structured format.
Proposed changes
Introduced a new crate, ockam_common, which includes the ValueParser struct.
ValueParser is designed to validate and decode hex-encoded strings into structured data representing Identity change history.
Implemented a ChangeHistoryParser which utilizes the ValueParser for argument parsing in CLI commands. This ensures that the inputs are validated and decoded properly before being used.
Checks