mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-18 23:15:36 +00:00
qm showcmd: add simple 'pretty' parameter
Shows each parameter value pair in a new line with a backslash at the end, so it's still possible to copy, paste and execute it, while being easier to read and edit by humans. This is opt in. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
f38de678e4
commit
16a01738cb
@ -117,6 +117,12 @@ __PACKAGE__->register_method ({
|
|||||||
additionalProperties => 0,
|
additionalProperties => 0,
|
||||||
properties => {
|
properties => {
|
||||||
vmid => get_standard_option('pve-vmid', { completion => \&PVE::QemuServer::complete_vmid }),
|
vmid => get_standard_option('pve-vmid', { completion => \&PVE::QemuServer::complete_vmid }),
|
||||||
|
pretty => {
|
||||||
|
description => "Puts each option on a new line to enhance human readability",
|
||||||
|
type => 'boolean',
|
||||||
|
optional => 1,
|
||||||
|
default => 0,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
returns => { type => 'null'},
|
returns => { type => 'null'},
|
||||||
@ -124,7 +130,11 @@ __PACKAGE__->register_method ({
|
|||||||
my ($param) = @_;
|
my ($param) = @_;
|
||||||
|
|
||||||
my $storecfg = PVE::Storage::config();
|
my $storecfg = PVE::Storage::config();
|
||||||
print PVE::QemuServer::vm_commandline($storecfg, $param->{vmid}) . "\n";
|
my $cmdline = PVE::QemuServer::vm_commandline($storecfg, $param->{vmid});
|
||||||
|
|
||||||
|
$cmdline =~ s/ -/ \\\n-/g if $param->{pretty};
|
||||||
|
|
||||||
|
print "$cmdline\n";
|
||||||
|
|
||||||
return undef;
|
return undef;
|
||||||
}});
|
}});
|
||||||
|
Loading…
Reference in New Issue
Block a user