[pve-devel] [PATCH guest-common] Bash completion helper for snapshot name
Rhonda D'Vine
rhonda at proxmox.com
Mon Nov 12 14:58:48 CET 2018
This is the bash completion helper function for completing the snapshot
name. This is used both in qemu-server and pve-container.
This patch is the base for the patches in qemu-server and pve-container.
Signed-off-by: Rhonda D'Vine <rhonda at proxmox.com>
---
PVE/AbstractConfig.pm | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/PVE/AbstractConfig.pm b/PVE/AbstractConfig.pm
index 4cfe9bc..12086b1 100644
--- a/PVE/AbstractConfig.pm
+++ b/PVE/AbstractConfig.pm
@@ -697,4 +697,17 @@ sub snapshot_rollback {
$class->lock_config($vmid, $updatefn);
}
+# bash completion helper
+
+sub complete_snapshot_name {
+ my ($class) = @_;
+ my $vmid = $_[4][0];
+
+ my $conf = $class->load_config($vmid);
+
+ my $snapshot = [ keys %{$conf->{snapshots}} ];
+
+ return $snapshot;
+}
+
1;
--
2.11.0
More information about the pve-devel
mailing list