Re: [PATCH 1/8] virsh: Add vshCmdCompleter and vshOptCompleter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08.08.2013 16:38, Tomas Meszaros wrote:
> completer and completer_flags added to the _vshCmdDef and _vshCmdOptDef
> structures so it will be possible for completion generators to
> conveniently call completer functions with desired flags.
> ---
>  tools/virsh-domain.c | 10 +++++-----
>  tools/virsh.h        |  7 +++++++
>  2 files changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 8cafce4..5e1196f 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -7889,10 +7889,10 @@ static const vshCmdInfo info_lxc_enter_namespace[] = {
>  };
>  
>  static const vshCmdOptDef opts_lxc_enter_namespace[] = {
> -    {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
> -    {"noseclabel", VSH_OT_BOOL, 0, N_("Do not change process security label")},
> -    {"cmd", VSH_OT_ARGV, VSH_OFLAG_REQ, N_("namespace")},
> -    {NULL, 0, 0, NULL}
> +    {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid"), NULL, 0},
> +    {"noseclabel", VSH_OT_BOOL, 0, N_("Do not change process security label"), NULL, 0},
> +    {"cmd", VSH_OT_ARGV, VSH_OFLAG_REQ, N_("namespace"), NULL, 0},
> +    {NULL, 0, 0, NULL, NULL, 0}
>  };
>  
>  static bool
> @@ -10276,7 +10276,7 @@ static const vshCmdOptDef opts_domfstrim[] = {
>       .type = VSH_OT_DATA,
>       .help = N_("which mount point to trim")
>      },
> -    {NULL, 0, 0, NULL}
> +    {NULL, 0, 0, NULL, NULL, 0}
>  };

These two ^^ has slipped my switch to C99 style initialization done a
while ago. In fact, if they were properly initialized in C99 these two
chunks wouldn't be here. I think you want to prepend a separate patch,
which will convert info_lxc_enter_namespace and opts_domfstrim into C99
style.

>  static bool
>  cmdDomFSTrim(vshControl *ctl, const vshCmd *cmd)
> diff --git a/tools/virsh.h b/tools/virsh.h
> index a407428..e07b546 100644
> --- a/tools/virsh.h
> +++ b/tools/virsh.h
> @@ -146,6 +146,9 @@ typedef struct _vshCmdOptDef vshCmdOptDef;
>  typedef struct _vshControl vshControl;
>  typedef struct _vshCtrlData vshCtrlData;
>  
> +typedef char **(*vshCmdCompleter)(unsigned int flags);
> +typedef char **(*vshOptCompleter)(unsigned int flags);
> +
>  /*
>   * vshCmdInfo -- name/value pair for information about command
>   *
> @@ -167,6 +170,8 @@ struct _vshCmdOptDef {
>      unsigned int flags;         /* flags */
>      const char *help;           /* non-NULL help string; or for VSH_OT_ALIAS
>                                   * the name of a later public option */
> +    vshOptCompleter completer;  /* option completer */
> +    unsigned int completer_flags;   /* option completer flags */
>  };
>  
>  /*
> @@ -198,6 +203,8 @@ struct _vshCmdDef {
>      const vshCmdOptDef *opts;   /* definition of command options */
>      const vshCmdInfo *info;     /* details about command */
>      unsigned int flags;         /* bitwise OR of VSH_CMD_FLAG */
> +    vshCmdCompleter completer;  /* command completer */
> +    unsigned int completer_flags;   /* command completer flags */
>  };
>  
>  /*
> 

The rest looks okay.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]