« Previous | Next » 

Revision 47988778

ID479887787ca5ef7eb8894aefc72bf36d485f87fb
Parent bdd55f71
Child 804a1e8e

Added by Iustin Pop over 16 years ago

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

Files

  • added
  • modified
  • copied
  • renamed
  • deleted

View differences