[pve-devel] [pve-common] print_api_result_plain: new helper

Dietmar Maurer dietmar at proxmox.com
Fri Jul 27 15:15:59 CEST 2018


Usefull to print result without borders an headers.

Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
 src/PVE/CLIFormatter.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/PVE/CLIFormatter.pm b/src/PVE/CLIFormatter.pm
index d964b51..2de29e2 100644
--- a/src/PVE/CLIFormatter.pm
+++ b/src/PVE/CLIFormatter.pm
@@ -436,4 +436,16 @@ sub print_api_result {
     }
 }
 
+sub print_api_result_plain {
+    my ($data, $result_schema, $props_to_print, $options, $terminal_opts) = @_;
+
+    # avoid borders and header
+    $options = $options ? { %$options } : {}; # copy
+
+    $options->{noheader} //= 1;
+    $options->{noborder} //= 1;
+
+    print_api_result($data, $result_schema, $props_to_print, $options, $terminal_opts);
+}
+
 1;
-- 
2.11.0




More information about the pve-devel mailing list