Rather than continually cut-n-paste the strings into each command, create a common macro to be used generically. Note that not all '{.name = "persistent",' entries are replaced, just those that have the common .help string of "make live change persistent". Non replaced instances are unique to the command. Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- tools/virsh-domain.c | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 29b18c9..476ba58 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -63,6 +63,12 @@ # define SA_SIGINFO 0 #endif +#define VIRSH_COMMON_OPT_DOMAIN_PERSISTENT \ + {.name = "persistent", \ + .type = VSH_OT_BOOL, \ + .help = N_("make live change persistent") \ + } \ + static virDomainPtr virshLookupDomainInternal(vshControl *ctl, const char *cmdname, @@ -211,10 +217,7 @@ static const vshCmdOptDef opts_attach_device[] = { .flags = VSH_OFLAG_REQ, .help = N_("XML file") }, - {.name = "persistent", - .type = VSH_OT_BOOL, - .help = N_("make live change persistent") - }, + VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, {.name = "config", .type = VSH_OT_BOOL, .help = N_("affect next boot") @@ -374,10 +377,7 @@ static const vshCmdOptDef opts_attach_disk[] = { .type = VSH_OT_BOOL, .help = N_("print XML document rather than attach the disk") }, - {.name = "persistent", - .type = VSH_OT_BOOL, - .help = N_("make live change persistent") - }, + VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, {.name = "config", .type = VSH_OT_BOOL, .help = N_("affect next boot") @@ -834,10 +834,7 @@ static const vshCmdOptDef opts_attach_interface[] = { .type = VSH_OT_STRING, .help = N_("control domain's outgoing traffics") }, - {.name = "persistent", - .type = VSH_OT_BOOL, - .help = N_("make live change persistent") - }, + VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, {.name = "config", .type = VSH_OT_BOOL, .help = N_("affect next boot") @@ -10862,10 +10859,7 @@ static const vshCmdOptDef opts_detach_device[] = { .flags = VSH_OFLAG_REQ, .help = N_("XML file") }, - {.name = "persistent", - .type = VSH_OT_BOOL, - .help = N_("make live change persistent") - }, + VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, {.name = "config", .type = VSH_OT_BOOL, .help = N_("affect next boot") @@ -10959,10 +10953,7 @@ static const vshCmdOptDef opts_update_device[] = { .flags = VSH_OFLAG_REQ, .help = N_("XML file") }, - {.name = "persistent", - .type = VSH_OT_BOOL, - .help = N_("make live change persistent") - }, + VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, {.name = "config", .type = VSH_OT_BOOL, .help = N_("affect next boot") @@ -11061,10 +11052,7 @@ static const vshCmdOptDef opts_detach_interface[] = { .type = VSH_OT_STRING, .help = N_("MAC address") }, - {.name = "persistent", - .type = VSH_OT_BOOL, - .help = N_("make live change persistent") - }, + VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, {.name = "config", .type = VSH_OT_BOOL, .help = N_("affect next boot") @@ -11473,10 +11461,7 @@ static const vshCmdOptDef opts_detach_disk[] = { .flags = VSH_OFLAG_REQ, .help = N_("target of disk device") }, - {.name = "persistent", - .type = VSH_OT_BOOL, - .help = N_("make live change persistent") - }, + VIRSH_COMMON_OPT_DOMAIN_PERSISTENT, {.name = "config", .type = VSH_OT_BOOL, .help = N_("affect next boot") -- 2.5.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list