mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virt-admin: Tweak command parsing logic so that aliases point to new commands
Change the logic in a way, so that VSH_CMD_FLAG_ALIAS behaves similarly to how VSH_OT_ALIAS for command options, i.e. there is no need for code duplication for the alias and the aliased command structures. Along with that change, switch any existing VSH_CMD_FLAG_ALIAS occurrences to this new format. Also, since this patch introduces a new command structure element, adjust the virsh-self-test test to make sure we won't ever miss to specify the '.alias' member for an aliased command because doing that would lead to an internal error. Signed-off-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
@@ -179,6 +179,7 @@ struct _vshCmdDef {
|
||||
const vshCmdOptDef *opts; /* definition of command options */
|
||||
const vshCmdInfo *info; /* details about command */
|
||||
unsigned int flags; /* bitwise OR of VSH_CMD_FLAG */
|
||||
const char *alias; /* name of the aliased command */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -445,7 +446,8 @@ bool cmdSelfTest(vshControl *ctl, const vshCmd *cmd);
|
||||
.handler = cmdSelfTest, \
|
||||
.opts = NULL, \
|
||||
.info = info_selftest, \
|
||||
.flags = VSH_CMD_FLAG_NOCONNECT | VSH_CMD_FLAG_ALIAS \
|
||||
.flags = VSH_CMD_FLAG_NOCONNECT | VSH_CMD_FLAG_ALIAS, \
|
||||
.alias = "self-test" \
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user