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

Make ockam space show (no args) interactive by asking the user to choose from a list of space names to show (tuify) #6472

Closed
nazmulidris opened this issue Oct 12, 2023 · 3 comments · Fixed by #6890
Assignees

Comments

@nazmulidris
Copy link
Contributor

nazmulidris commented Oct 12, 2023

Current behavior

When a user runs ockam space show without any arguments, currently they are shown some 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:

  • the terminal is interactive, and,
  • the --no-input or --quiet flags have not been passed, and,
  • no arguments have been passed in to the command.

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 space names. They should be able to make multiple selections. If there are none, then simply display a message saying that none exist (not an error).

  2. Once the user has made their selection(s), then run show for each selected space, and display the results of the show command for each space that they've selected.

    • They should be able to make a single selection.
    • If they have made no selections then exit by displaying a message to the user letting them know they did not make any selection.

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

  • Please use the functions select_multiple, and confirm_interactively in this file.

  • Here's a similar PR to get some ideas from: delete node interactively #6480

  • You can learn more about how to use the select_from_list() in the tuify crate here. Here is an example that is very similar to the steps you might have to take for this issue.

  • Here's a file you can look at to detect when a terminal is interactive or not.

  • Here's a file you can look at to see where the ockam space show command is implemented.


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.

@nazmulidris
Copy link
Contributor Author

nazmulidris commented Oct 24, 2023

@niss36 👋 Since you've raised a PR for this issue #6695 can you comment here, so I can assign it to you 👍

@Darioazzali
Copy link
Contributor

May I take this please?

@nazmulidris
Copy link
Contributor Author

@Darioazzali That's awesome, this is all yours. Also, please checkout the tui.rs file that Adrian added to help you implement this: #6884

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants