mirror of
https://github.com/libvirt/libvirt.git
synced 2026-08-19 01:24:42 -05:00
virsh: Add vshCompletePathLocalCreate completer for output paths
Add a completer callback for local file paths used as command output, where the target file may not exist yet. Use it for 'dump', 'save', and 'blockcopy' commands, and fix 'screenshot' to use it instead of vshCompletePathLocalExisting. Partially-fixes: https://gitlab.com/libvirt/libvirt/-/work_items/9 Signed-off-by: Radoslaw Smigielski <rsmigiel@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
committed by
Peter Krempa
parent
ded31a922d
commit
6593d1d588
@@ -2629,6 +2629,7 @@ static const vshCmdOptDef opts_blockcopy[] = {
|
||||
{.name = "dest",
|
||||
.type = VSH_OT_STRING,
|
||||
.unwanted_positional = true,
|
||||
.completer = vshCompletePathLocalCreate,
|
||||
.help = N_("path of the copy to create")
|
||||
},
|
||||
{.name = "bandwidth",
|
||||
@@ -4651,6 +4652,7 @@ static const vshCmdOptDef opts_save[] = {
|
||||
.type = VSH_OT_STRING,
|
||||
.positional = true,
|
||||
.required = true,
|
||||
.completer = vshCompletePathLocalCreate,
|
||||
.help = N_("where to save the data")
|
||||
},
|
||||
{.name = "bypass-cache",
|
||||
@@ -5911,6 +5913,7 @@ static const vshCmdOptDef opts_dump[] = {
|
||||
.type = VSH_OT_STRING,
|
||||
.positional = true,
|
||||
.required = true,
|
||||
.completer = vshCompletePathLocalCreate,
|
||||
.help = N_("where to dump the core")
|
||||
},
|
||||
VIRSH_COMMON_OPT_LIVE(N_("perform a live core dump if supported")),
|
||||
@@ -6081,7 +6084,7 @@ static const vshCmdOptDef opts_screenshot[] = {
|
||||
{.name = "file",
|
||||
.type = VSH_OT_STRING,
|
||||
.unwanted_positional = true,
|
||||
.completer = vshCompletePathLocalExisting,
|
||||
.completer = vshCompletePathLocalCreate,
|
||||
.help = N_("where to store the screenshot")
|
||||
},
|
||||
{.name = "screen",
|
||||
|
||||
@@ -172,6 +172,23 @@ vshCompletePathLocalExisting(vshControl *ctl G_GNUC_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* vshCompletePathLocalCreate:
|
||||
*
|
||||
* Complete a path to local file used as output.
|
||||
* The outout file may not exist yet.
|
||||
*
|
||||
* Note: For now this is a no-op.
|
||||
*/
|
||||
char **
|
||||
vshCompletePathLocalCreate(vshControl *ctl G_GNUC_UNUSED,
|
||||
const vshCmd *cmd G_GNUC_UNUSED,
|
||||
unsigned int completerflags G_GNUC_UNUSED)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* vshCompleteEmpty:
|
||||
*
|
||||
|
||||
@@ -35,6 +35,11 @@ vshCompletePathLocalExisting(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int completerflags);
|
||||
|
||||
char **
|
||||
vshCompletePathLocalCreate(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
unsigned int completerflags);
|
||||
|
||||
char **
|
||||
vshCompleteEmpty(vshControl *ctl,
|
||||
const vshCmd *cmd,
|
||||
|
||||
Reference in New Issue
Block a user