On Mon, Dec 01, 2014 at 10:25:51AM +0800, Hu Tao wrote:
On Fri, Nov 28, 2014 at 03:00:39PM +0100, Pino Toscano wrote:
On Friday 28 November 2014 17:55:51 Hu Tao wrote:
This patch lets guestfish show command synopsis if the syntax of command issued by user is wrong, rather than telling user that the number of parameters is wrong.
The idea seems sound to me.
Shouldn't that be done also for fish commands? If so, just make "synopsis" a function taking args and optargs, and use it in both places.
fish commands do not have args and optargs in their definitions in file actions.ml. Also, fish commands' synopsises are printed out by inline codes, see run_alloc() for an example.
Surely we can reconstruct fish commands' definitions to take advantage of the auto-generation of synopsis done in this patch, but that can be another patch. I'll add this to my todo list.
After some dig, the only problem I don't know how to solve is commands with variable-length parameters, such as copy-in. Its synopsis is: copy-in local [local ...] /remotedir At first think its style could be: "style = RErr, [StringList "local"], []; But it seems the syntax corresponding to StringList is: copy-in "local local" /remotedir e.g. its a one parameter of List type, but not several parameters. Any ideas? Regards, Hu