
On 17/12/15 17:55, John Ferlan wrote:
Rather than continually cut-n-paste the strings into each command, create a common macro to be used generically. Note that not all '{.name = "domain",' entries are replaced, just those that have the common .help string of "domain name, id or uuid" and those that are required.
Other instances won't take all 3 options, but some subset of those options as directed by the virshCommandOptDomainBy flags argument or in some instances where the domain is not a required option.
Signed-off-by: John Ferlan <jferlan@redhat.com> --- tools/virsh-domain.c | 450 +++++++++------------------------------------------ 1 file changed, 80 insertions(+), 370 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 7650535..e766ec4 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -63,6 +63,12 @@ # define SA_SIGINFO 0 #endif
+#define VSH_DOMAIN_OPT_COMMON \ + {.name = "domain", \ + .type = VSH_OT_DATA, \ + .flags = VSH_OFLAG_REQ, \ + .help = N_("domain name, id or uuid") \ + } \
Since generic 'vsh.c' module introduction in commit 834c5720, we prefix macros/constants/methods with VIRSH/virsh within all virsh modules. Erik