From 98437f4c856e2bfb7f7f97ee72f4f2e9ee6913d1 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 1 Oct 2015 07:12:07 +0200 Subject: [PATCH] add bash completion for content type --- PVE/API2/Storage/Content.pm | 1 + PVE/API2/Storage/Status.pm | 1 + PVE/Storage.pm | 6 ++++++ PVE/Storage/Plugin.pm | 1 + 4 files changed, 9 insertions(+) diff --git a/PVE/API2/Storage/Content.pm b/PVE/API2/Storage/Content.pm index 68cb713..e33888e 100644 --- a/PVE/API2/Storage/Content.pm +++ b/PVE/API2/Storage/Content.pm @@ -34,6 +34,7 @@ __PACKAGE__->register_method ({ description => "Only list content of this type.", type => 'string', format => 'pve-storage-content', optional => 1, + completion => \&PVE::Storage::complete_content_type, }, vmid => get_standard_option ('pve-vmid', { diff --git a/PVE/API2/Storage/Status.pm b/PVE/API2/Storage/Status.pm index e04e184..b00aa67 100644 --- a/PVE/API2/Storage/Status.pm +++ b/PVE/API2/Storage/Status.pm @@ -49,6 +49,7 @@ __PACKAGE__->register_method ({ description => "Only list stores which support this content type.", type => 'string', format => 'pve-storage-content-list', optional => 1, + completion => \&PVE::Storage::complete_content_type, }, enabled => { description => "Only list stores which are enabled (not disabled in config).", diff --git a/PVE/Storage.pm b/PVE/Storage.pm index 3f46eb3..d26499d 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -1228,4 +1228,10 @@ sub complete_storage_enabled { return $res; } +sub complete_content_type { + my ($cmdname, $pname, $cvalue) = @_; + + return [qw(rootdir images vztmpl iso backup)]; +} + 1; diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm index 6a1d6b6..603e75d 100644 --- a/PVE/Storage/Plugin.pm +++ b/PVE/Storage/Plugin.pm @@ -27,6 +27,7 @@ my $defaultData = { description => "Allowed content types. Note: value 'rootdir' is used for Containers, and value 'images' for KVM-Qemu VM's.\n", type => 'string', format => 'pve-storage-content-list', optional => 1, + completion => \&PVE::Storage::complete_content_type, }, disable => { description => "Flag to disable the storage.", -- 2.39.2