mirror of
https://git.proxmox.com/git/pve-common
synced 2025-08-07 11:00:36 +00:00
cli: print_text_table: default to autosort on
we more often want to sort by the leftmost valid column than not. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
fa7d20bf9f
commit
9ac6416ec8
@ -445,15 +445,15 @@ sub data_to_text {
|
|||||||
# $data - the data to print (array of objects)
|
# $data - the data to print (array of objects)
|
||||||
# $returnprops -json schema property description
|
# $returnprops -json schema property description
|
||||||
# $props_to_print - ordered list of properties to print
|
# $props_to_print - ordered list of properties to print
|
||||||
# $sort_key is either a column name, or integer 1 which simply
|
# $sort_key can be used to sort after a column, if it isn't set we sort
|
||||||
# sorts the output according to the leftmost column not containing
|
# after the leftmost column (with no undef value in $data) this can be
|
||||||
# any undef. if not specified, we do not change order.
|
# turned off by passing 0 as $sort_key
|
||||||
sub print_text_table {
|
sub print_text_table {
|
||||||
my ($data, $returnprops, $props_to_print, $sort_key) = @_;
|
my ($data, $returnprops, $props_to_print, $sort_key) = @_;
|
||||||
|
|
||||||
my $autosort = 0;
|
my $autosort = 1;
|
||||||
if (defined($sort_key) && ($sort_key eq 1)) {
|
if (defined($sort_key) && $sort_key eq 0) {
|
||||||
$autosort = 1;
|
$autosort = 0;
|
||||||
$sort_key = undef;
|
$sort_key = undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user