Skip to content
Snippets Groups Projects
Commit 47988778 authored by Iustin Pop's avatar Iustin Pop
Browse files

Improve the cli.AskUser() function

This patch improves the AskUser function by allowing it to:
 - choose from multiple choices (instead of only y/n)
 - give help to the user
 - preserve line breaks and whitespace formatting in the message

With this patch, an instance removal looks like this:
root@xen-test1-4:~# gnt-instance remove tsetest1
This will remove the volumes of the instance tsetest1 (including
mirrors), thus removing all the data of the instance. Continue?
y/[n]/?: ?
 y - Perform the operation
 n - Do not perform the operation

This will remove the volumes of the instance tsetest1 (including
mirrors), thus removing all the data of the instance. Continue?
y/[n]/?: y

The patch also removed the _ask_user member of the opts argument, since
external code was using it (and thus it makes no sense for it to be a
private member); now gnt-* scripts are using the AskUser function
directly.

Reviewed-by: ultrotter
parent bdd55f71
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment