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

Question about get_user_continue #322

Open
dimitry-ishenko opened this issue Dec 14, 2024 · 3 comments
Open

Question about get_user_continue #322

dimitry-ishenko opened this issue Dec 14, 2024 · 3 comments
Labels
Discussion Being discussed - Voice your opinions :)

Comments

@dimitry-ishenko
Copy link
Collaborator

dimitry-ishenko commented Dec 14, 2024

@Tearran trying to understand what's going on inside get_user_continue function. In the code it's always used with process_input. And if I select No when asked "Do you wish to continue?" the program just exits instead of returning to the menu...

Why doesn't get_user_continue just return 0 or 1 codes? Or is there a deeper design plot that I've failed to grasp?

@dimitry-ishenko dimitry-ishenko added Task/To-Do Project management: To-Do or task(s) someone is working on Discussion Being discussed - Voice your opinions :) and removed Task/To-Do Project management: To-Do or task(s) someone is working on labels Dec 14, 2024
@Tearran
Copy link
Member

Tearran commented Dec 14, 2024

Why doesn't get_user_continue just return 0 or 1 codes? Or is there a deeper design plot that I've failed to grasp?

Simply put, return breaks the group. Saying no continus and installs anyways.

The reason this exist is to offer a warning and/or user agreement to continue. before system files are changed. Can use some refinement. Even refactored.

This probably over complex setup was to be used for inclusion for the nuanced difference of whiptail and dialog and read.

Background I am not a fan of loops or nesting in bash haven't had need for returns when piping echos. The UX aspects aside, The approach I prefer to take with bash is do linear procedure, pipe out or exit.

And if I select No when asked "Do you wish to continue?" the program just exits instead of returning to the menu...

This has been a point before, The reason why return was not looked into. responding no to do you want to continue does not translates to continuing the loop.

Note: my selfish reason so i don't have to going back, back and back and sometime back again to be able to exit is cumbersome. CTL-C needs to be implemented or fixed.

@dimitry-ishenko
Copy link
Collaborator Author

I see, basically the reason I asked is that my idea of closing stdin for non-interactive mode (#320 (comment)) has one gotcha.

If the function being called with --api tries to show a dialog asking for user input (eg, the one shown by get_user_continue) the program will hang (since stdin is closed and there is no way for the user to input anything).

In non-interactive mode (with --api) we don't want user interaction anyway, so I was thinking of having this function do a similar check for stdin ([[ -t 0 ]]) and if it's closed, assume the answer is yes.

What do you think?

@Tearran
Copy link
Member

Tearran commented Dec 18, 2024

If in Non interactive/automation/advanced mode continuing is a default and aculay running the get_user_continue helper or any UX helpers should be expected to break an non interactive pipeline.

non interactive should go directly to module_name "$@" .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Being discussed - Voice your opinions :)
Projects
None yet
Development

No branches or pull requests

2 participants