mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
virsh: completer: Introduce dummy completer for local files
For now the completion does the correct thing of completing a local path if NULL is returned. Introduce 'virshCompletePathLocalExisting' and use it in the 'VIRSH_COMMON_OPT_FILE' macro. This for now serves as an annotation for the function which want to read a file on the host running virsh. In the future this can be used with a more sophisticated implementation. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
bc4739ed77
commit
16252b16b7
@ -128,3 +128,20 @@ virshCommaStringListComplete(const char *input,
|
||||
|
||||
return g_steal_pointer(&ret);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virshCompletePathLocalExisting:
|
||||
*
|
||||
* Complete a path to a existing file used as input. The file is used as input
|
||||
* for virsh so only local files are considered.
|
||||
*
|
||||
* Note: For now this is a no-op. Readline does the correct thing.
|
||||
*/
|
||||
char **
|
||||
virshCompletePathLocalExisting(vshControl *ctl G_GNUC_UNUSED,
|
||||
const vshCmd *cmd G_GNUC_UNUSED,
|
||||
unsigned int completerflags G_GNUC_UNUSED)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -35,3 +35,8 @@
|
||||
char **
|
||||
virshCommaStringListComplete(const char *input,
|
||||
const char **options);
|
||||
|
||||
char **
|
||||
virshCompletePathLocalExisting(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int completerflags);
|
||||
|
@ -100,6 +100,7 @@
|
||||
{.name = "file", \
|
||||
.type = VSH_OT_DATA, \
|
||||
.flags = VSH_OFLAG_REQ, \
|
||||
.completer = virshCompletePathLocalExisting, \
|
||||
.help = _helpstr \
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user