> -----Original Message----- > From: Peter Krempa [mailto:pkrempa@xxxxxxxxxx] > Sent: Friday, October 25, 2013 4:52 PM > To: Chen Hanxiao; libvir-list@xxxxxxxxxx > > const char *name; > > + const char *exclude_option; > > We use camelCase for struct member names. Also some options might > invalidate more than one other option thus it is desirable to have this > as a NULL terminated string list of options this option invalidates. > > Later on we may use this to do automatic checking for mutually exclusive > options that are now declared using macros in the code. > > > > > > if (!state) { > > /* determine command name */ > > > @@ -2720,6 +2722,12 @@ vshReadlineOptionsGenerator(const char *text, > int state) > > /* ignore non --option */ > > continue; > > > > + if (len == 2 && opt->type == VSH_OT_ALIAS) > > + continue; > > I think we should always ignore aliases. We introduced aliases to change > command names without breaking compatibility with scripts. For human > interaction we shouldn't encourage to use deprecated and undocumented > stuff even if the user remebered that such command was possibly available. > > > + > > + if (exclude_option && (strstr(rl_line_buffer, exclude_option))) > > + continue; > > This should then iterate the array of exclusive options. > > > + > > if (len > 2) { > > if (STRNEQLEN(name, text + 2, len - 2)) > > continue; > > diff --git a/tools/virsh.h b/tools/virsh.h > > index b843788..89b284f 100644 > > --- a/tools/virsh.h > > +++ b/tools/virsh.h > > @@ -173,6 +173,7 @@ struct _vshCmdOptDef { > > * the name of a later public option > */ > > vshCompleter completer; /* option completer */ > > unsigned int completer_flags; /* option completer flags */ > > + const char *exclude_option; /* check the exclusion of option */ > > As said above. Please use camelCase and turn this into the opti > > Thanks for your review. v2 patch will come soon based on your comments. > > > }; > > > > /* > > > > Peter -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list