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: git-like usage commands #338

Merged
merged 22 commits into from
May 15, 2024
Merged

Conversation

tomyrd
Copy link
Collaborator

@tomyrd tomyrd commented May 13, 2024

closes #333

The previous command structure was tree-like with sub-commands hidden inside other sub-commands. This PR looks to change the structure to be more git-like with a lot of top level commands with flags that modify their functionality.

Some screenshots provided by @mFragaBA:
image
image
image
image
image
image
image
image

@tomyrd tomyrd changed the base branch from main to igamigo-next-0.3 May 13, 2024 18:52
@igamigo
Copy link
Collaborator

igamigo commented May 13, 2024

Looks good so far! I am personally not sure if I prefer the flatter structure versus the more subcommand-based one. It seems a bit more usable/cleaner at first sight, but also it showcases the types of entities that are involved a little less. But in any case, here are some notes of what I reviewed so far if we decide to go this route:

  • I'd change --acc-type to --type in the new-account command, since it feels a bit redundant.
  • I think I'd change the "Config updated..." to "Set the default account to {account_id}" (and "Removed the default account" for unsetting it) or something similar
  • I think --default none is not ideal but I couldn't think of anything better
  • We'd have to be careful with the docs (both here and in miden-base)

@bobbinth
Copy link
Contributor

It seems a bit more usable/cleaner at first sight, but also it showcases the types of entities that are involved a little less.

Agreed - but I think we can showcase the entities via the client library interface and CLI could still be a bit more "customized" to make it more user friendly.

I'd change --acc-type to --type in the new-account command, since it feels a bit redundant.

As I mentioned in #333 (comment), I'd probably split this into two commands new-wallet and new-faucet. This way, both commands would be simpler (in terms of options to chose from).

@tomyrd tomyrd force-pushed the tomyrd-command-refactor branch from 34f554d to d7fbe1f Compare May 14, 2024 14:48
Copy link
Contributor

@mFragaBA mFragaBA left a comment

Choose a reason for hiding this comment

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

Nice work! Left a few comments

src/cli/export.rs Outdated Show resolved Hide resolved
src/cli/import.rs Outdated Show resolved Hide resolved
src/cli/new_account.rs Outdated Show resolved Hide resolved
src/cli/new_account.rs Outdated Show resolved Hide resolved
src/cli/new_account.rs Outdated Show resolved Hide resolved
src/cli/new_account.rs Outdated Show resolved Hide resolved
src/cli/new_account.rs Show resolved Hide resolved
src/cli/notes.rs Outdated Show resolved Hide resolved
src/cli/mod.rs Show resolved Hide resolved
src/cli/new_account.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@mFragaBA mFragaBA left a comment

Choose a reason for hiding this comment

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

It wasn't changed in this PR but I noticed that for the init command we show:

image

The user isn't asked for an input if --store-path isn't provided.

Can we fix that?

src/cli/notes.rs Outdated Show resolved Hide resolved
src/cli/account.rs Outdated Show resolved Hide resolved
CHANGELOG.md Outdated
@@ -1,5 +1,6 @@
# Changelog

* Flatten the cli subcommand tree.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* Flatten the cli subcommand tree.
* Flatten the CLI subcommand tree.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

@mFragaBA mFragaBA left a comment

Choose a reason for hiding this comment

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

send has two options that use -f as the shortened version (--force, --faucet)

Copy link
Contributor

@mFragaBA mFragaBA left a comment

Choose a reason for hiding this comment

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

LGTM!

@tomyrd tomyrd marked this pull request as ready for review May 15, 2024 20:22
@igamigo igamigo merged commit b986b56 into igamigo-next-0.3 May 15, 2024
6 checks passed
@igamigo igamigo deleted the tomyrd-command-refactor branch May 15, 2024 20:43
igamigo added a commit that referenced this pull request May 15, 2024
* feat: Integrate next changes

* fix: Back to next

* Fix conflicts

* Use node next

* fix: Tetss

* refactor: reuse function to create mocked client

* fix: update swap note script root

* fix: Generalize Authenticator

* Merge fixes and refactors

* Lints

* docs: update docs from changes to CLI (#336)

* feat: Utilize expected notes from `ExecutedTransaction` (#329)

* feat: Use expected notes from TransactionResult

* fix: Re-add output note check

* Remove unused code

* Lints

* Fix tests

* fix: Tetss

* Stash

* fix: Address reviews

* fix: Tests

* fix: Lints

* fix: Lints

* Try fix test

* fix: Merge conflicts

* Fix tests

* docs: Address reviews

* Lints

* fix: New script root

* Use 0.3

* fix: Correct genesis toml file

* fix: test fix con cargo make start-node

* fix: temp fix to rename config paths

* fix: Correct miden-node toml

* fix: Ship our own node config files

* Migrate to node 0.3

* feat: Use incoming MMR proof to add block authentications for notes created in past blocks (#337)

* test: Integration tests run with main node

* fix: Remove std::cmp::max

* refactor: git-like usage commands (#338)

* Move new account creation to command

* Flatten account command

* Refactor `default` option

* Separate new account commands

* Refactor `notes` command

* Refactor import comand to infer type

* Remove intermediate sucommand for export

* Flatten tags command

* Separate tx new commands

* Fix documentation

* Join p2id and p2idr to send command

* Remove trait

* Change comment suggestions

* Clarify new account help comments

* Ask for storage path if not specified

* Fixed problem with listing notes with no filter

* Added a message for default account updates

* Change suggestions

* Remove prompt for store path

* Added all NotesFilter

* Fix merge

* feat: enable swap notes (#324)

* feature: add swap tx request and store swap payback note

* feature: insert input note record from payback note details

* feature: show message to user on how to track payback notes

* fix: integration test compilation

* make swap tx send the offered asset

* fix: temporary fix for partial output notes

* test: add skeleton for integration test

* fix: lint issues

* test: add test for onchain swap flow

* test: add test for offchain swap flow

* test: fix note minting for swap tests

* test: fix compilation errors

* fix: use all committed note ids to check transactions to commit

* fix: fix tests checks

* address review comments

* docs: update CHANGELOG

* docs: update CLI reference

* address remaining comment

* fix: clippy issues

* fix: remove wrong check

* refactor: store partial notes in relevant notes of transaction result

* rephrase doc comment

Co-authored-by: igamigo <[email protected]>

* address review comments

* fix: fix offchain swap test

---------

Co-authored-by: igamigo <[email protected]>

* docs: fix doc comments for swap clap command

* feat: update cli-reference with new command structure (#342)

* Update cli-reference with new command structure

* Fix merge

* Fix merge

* Update cli-reference.md

---------

Co-authored-by: igamigo <[email protected]>

* Update README.md

* CLI config.md

---------

Co-authored-by: Martin Fraga <[email protected]>
Co-authored-by: Martin Fraga <[email protected]>
Co-authored-by: Tomas Rodriguez Dala <[email protected]>
bobbinth pushed a commit that referenced this pull request May 15, 2024
* feat: Integrate next changes

* fix: Back to next

* Fix conflicts

* Use node next

* fix: Tetss

* refactor: reuse function to create mocked client

* fix: update swap note script root

* fix: Generalize Authenticator

* Merge fixes and refactors

* Lints

* docs: update docs from changes to CLI (#336)

* feat: Utilize expected notes from `ExecutedTransaction` (#329)

* feat: Use expected notes from TransactionResult

* fix: Re-add output note check

* Remove unused code

* Lints

* Fix tests

* fix: Tetss

* Stash

* fix: Address reviews

* fix: Tests

* fix: Lints

* fix: Lints

* Try fix test

* fix: Merge conflicts

* Fix tests

* docs: Address reviews

* Lints

* fix: New script root

* Use 0.3

* fix: Correct genesis toml file

* fix: test fix con cargo make start-node

* fix: temp fix to rename config paths

* fix: Correct miden-node toml

* fix: Ship our own node config files

* Migrate to node 0.3

* feat: Use incoming MMR proof to add block authentications for notes created in past blocks (#337)

* test: Integration tests run with main node

* fix: Remove std::cmp::max

* refactor: git-like usage commands (#338)

* Move new account creation to command

* Flatten account command

* Refactor `default` option

* Separate new account commands

* Refactor `notes` command

* Refactor import comand to infer type

* Remove intermediate sucommand for export

* Flatten tags command

* Separate tx new commands

* Fix documentation

* Join p2id and p2idr to send command

* Remove trait

* Change comment suggestions

* Clarify new account help comments

* Ask for storage path if not specified

* Fixed problem with listing notes with no filter

* Added a message for default account updates

* Change suggestions

* Remove prompt for store path

* Added all NotesFilter

* Fix merge

* feat: enable swap notes (#324)

* feature: add swap tx request and store swap payback note

* feature: insert input note record from payback note details

* feature: show message to user on how to track payback notes

* fix: integration test compilation

* make swap tx send the offered asset

* fix: temporary fix for partial output notes

* test: add skeleton for integration test

* fix: lint issues

* test: add test for onchain swap flow

* test: add test for offchain swap flow

* test: fix note minting for swap tests

* test: fix compilation errors

* fix: use all committed note ids to check transactions to commit

* fix: fix tests checks

* address review comments

* docs: update CHANGELOG

* docs: update CLI reference

* address remaining comment

* fix: clippy issues

* fix: remove wrong check

* refactor: store partial notes in relevant notes of transaction result

* rephrase doc comment

Co-authored-by: igamigo <[email protected]>

* address review comments

* fix: fix offchain swap test

---------

Co-authored-by: igamigo <[email protected]>

* docs: fix doc comments for swap clap command

* feat: update cli-reference with new command structure (#342)

* Update cli-reference with new command structure

* Fix merge

* Fix merge

* Update cli-reference.md

---------

Co-authored-by: igamigo <[email protected]>

* Update README.md

* CLI config.md

---------

Co-authored-by: Martin Fraga <[email protected]>
Co-authored-by: Martin Fraga <[email protected]>
Co-authored-by: Tomas Rodriguez Dala <[email protected]>
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.

Refactor commands in favor of git-like usage
4 participants