build-trust / ockam

Orchestrate end-to-end encryption, cryptographic identities, mutual authentication, and authorization policies between distributed applications – at massive scale.
https://ockam.io
Apache License 2.0
4.47k stars 562 forks source link

Make `ockam node stop` (no args) interactive by asking the user to choose from a list of nodes to start (tuify) #6660

Closed nazmulidris closed 11 months ago

nazmulidris commented 1 year ago

Current behavior

When a user runs ockam node stop without any arguments, currently they are shown help text. Here's a screenshot of this.

Image

Desired behavior

Change the behavior of this command so that it becomes interactive with the user when no arguments are passed. Note that this can only be allowed to happen if:

This what the user flow should look like in interactive mode.

1) Use the tuify crate's select_from_list() function to ask the user to select from a list of nodes that have been started. They should be able to make multiple selections. If there are none, then simply display a message saying that none exist (not an error) and exit.

2) Once the user has made their selection(s), display a confirmation prompt letting the user know that that stop is about to be called with the nodes they have selected. Use select_from_list() to display this prompt. They should be able to make a single selection.

3) If they choose "YES", then run stop for each selected nodes, and display the results of the stop command for each nodes that they've selected.

The following is a video showing a generic user flow that shows the user experience when a user is asked to choose a from a list of "things". Then an action is performed on each "thing". Finally status information is reported for each action that is performed on each "thing". Please note that this flow is not specific to this issue. Image https://asciinema.org/a/612547

Implementation details


We love helping new contributors! ❤️ If you have questions or need help as you explore, please join us on Discord. If you're looking for other issues to contribute to, please checkout our good first issues.

Lumexralph commented 1 year ago

@nazmulidris I'll like to attempt this, please, can you assign it to me?

nazmulidris commented 1 year ago

@Lumexralph That's awesome, this is all yours. Please let us know if you have any questions as you explore. You can also ask questions on the contributors discord https://discord.gg/RAbjRr3kds

Lumexralph commented 1 year ago

@nazmulidris I think I have finished working on this but I need to run it to check it out.

Is there a way I can do this?

nazmulidris commented 1 year ago

@Lumexralph You can follow the instructions here to create some nodes and then start / stop them.

You can also follow this manual here to create nodes so that you can play w/ starting and stopping them.

To build and run Ockam command from source, you can check this out: README.md.

Lumexralph commented 1 year ago

thanks @nazmulidris

nazmulidris commented 1 year ago

@Lumexralph You are most welcome. You can also ask questions on the contributors discord https://discord.gg/RAbjRr3kds 👍🏽