improve bash completions

This commit is contained in:
Dietmar Maurer
2015-09-18 09:33:09 +02:00
parent c669f42d4e
commit f7621c0126
3 changed files with 30 additions and 3 deletions

View File

@ -1167,4 +1167,25 @@ sub foreach_volid {
}
}
# bash completion helper
sub complete_storage {
my ($cmdname, $pname, $cvalue) = @_;
return $cmdname eq 'add' ? [] : [ PVE::Storage::storage_ids() ];
}
sub complete_storage_enabled {
my ($cmdname, $pname, $cvalue) = @_;
my $res = [];
my $cfg = PVE::Storage::config();
foreach my $sid (keys %{$cfg->{ids}}) {
next if !storage_check_enabled($cfg, $sid, undef, 1);
push @$res, $sid;
}
return $res;
}
1;