[pve-devel] [pve-container cli cleanup 1/5] pct list: use print_api_result
Dietmar Maurer
dietmar at proxmox.com
Thu Aug 9 11:43:35 CEST 2018
Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
src/PVE/CLI/pct.pm | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index 6296d6f..8cc57c3 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -14,6 +14,7 @@ use PVE::Cluster;
use PVE::INotify;
use PVE::RPCEnvironment;
use PVE::JSONSchema qw(get_standard_option);
+use PVE::CLIFormatter;
use PVE::CLIHandler;
use PVE::API2::LXC;
use PVE::API2::LXC::Config;
@@ -717,14 +718,10 @@ __PACKAGE__->register_method ({
our $cmddef = {
list=> [ 'PVE::API2::LXC', 'vmlist', [], { node => $nodename }, sub {
- my $res = shift;
- return if !scalar(@$res);
- my $format = "%-10s %-10s %-12s %-20s\n";
- printf($format, 'VMID', 'Status', 'Lock', 'Name');
- foreach my $d (sort {$a->{vmid} <=> $b->{vmid} } @$res) {
- printf($format, $d->{vmid}, $d->{status}, $d->{lock}, $d->{name});
- }
- }],
+ my ($data, $schema, $options) = @_;
+ my $proplist = ['vmid', 'name', 'status', 'cpus', 'maxmem', 'maxswap', 'maxdisk', 'uptime'];
+ PVE::CLIFormatter::print_api_result($data, $schema, $proplist, $options);
+ }, $PVE::RESTHandler::standard_output_options],
config => [ "PVE::API2::LXC::Config", 'vm_config', ['vmid'],
{ node => $nodename }, sub {
my $config = shift;
--
2.11.0
More information about the pve-devel
mailing list