[libvirt] [PATCH 2/2] virsh: Allow users to reedit rejected XML

Michal Privoznik mprivozn at redhat.com
Tue May 22 15:45:32 UTC 2012


On 22.05.2012 14:41, Eric Blake wrote:
> On 05/22/2012 03:49 AM, Michal Privoznik wrote:
>> On 18.05.2012 19:27, Eric Blake wrote:
>>> On 05/18/2012 06:48 AM, Michal Privoznik wrote:
>>>> If users *-edit but make a mistake in XML all changes are
>>>> permanently lost. However, if virsh is not running within
>>>> a script we can as user if he wants to re-edit the file
>>>
> 
>>>
>>> [1] ...you are blindly calling it from all platforms here.  You need to
>>> fix mingw compilation.
>>
>> Okay, on mingw I've make vshAskReedit function return always 0.
> 
> Makes sense - if we don't know how to ask the question, then it is the
> same as if we asked the question and the answer was successfully 'no'.
> 
> 
>>>   /* TRANSLATORS: For now, we aren't using LC_MESSAGES, and the user
>>>      choices really are limited to just 'y' and 'n'.  */
>>> vshPrintf(ctl, "\r%s", _("Failed. Try again..."));
>>
>> Well, if I take into account your last e-mail, how should this message
>> look like? I mean - how offer users 3 choices with intuitive names hence
>> shortcuts?
>>
>> Failed. [R]eedit/[S]tart over again/[Q]uit?
> 
> Eww. That does raise an interesting question.  Maybe it's better to make
> it a two part question:
> 
> 1. Simultaneous external edit detected.  Continue your edit [y/n]?
> 
> and if yes,
> 
> 2. Discard local edits by reloading external state [y/n]?
> 
> or something along those lines, where we can at a minimum reuse our
> yes/no parsing (and thus have only one place that needs to learn I18N in
> the future).
> 

I don't like being asked twice. I think users would prefer one question
with many answers, e.g. 'git add -p' produces:

	Stage this hunk [y,n,q,a,d,/,e,?]?

So maybe:

	Failed. Try again [y,n,f,?]?

with '?' printing out:
y - yes
n - no
f - force to continue with my change and drop changes made meanwhile
? - print this help

Michal




More information about the libvir-list mailing list