On Fri, Mar 23, 2018 at 02:09:58PM +0100, Pino Toscano wrote: > Here I'd do the check of the options (both input and output) by > prefixes, i.e. things like: > > List.iter ( > fun key -> > if not (String.is_prefix key "vddk-") || > not (List.mem key vddk_option_keys) then > error (f_"-it vddk: ‘-io %s’ is not a valid input option") key > ) keys; > > So most probably adding a simple function to get the prefix of options > per-input and per-output mode, and using it to check.
Yeah I didn't necessarily want to restrict the options to use a particular prefix. For example it might be worth allowing -o rhv-upload to use both rhv- and ovirt- prefixes. In any case this is actually checked already by the individual modules, so I don't think adding another check gains much except complexity. BTW when I sat down this morning I thought: why didn't I implement this using methods on the input/output object? The answer (after a bit of trying to rewrite it that way) is that we don't have the fully created objects until it's too late to set the options. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
