]>
Commit | Line | Data |
---|---|---|
f53ad23a DM |
1 | package PVE::CLIFormatter; |
2 | ||
3 | use strict; | |
4 | use warnings; | |
fb3a1b29 | 5 | |
4ac85000 | 6 | use I18N::Langinfo; |
5e287f60 | 7 | use POSIX qw(strftime); |
ba752c80 | 8 | use CPAN::Meta::YAML; # comes with perl-modules |
4ac85000 | 9 | |
84142f1d | 10 | use PVE::JSONSchema; |
4ac85000 | 11 | use PVE::PTY; |
fb3a1b29 | 12 | |
f53ad23a | 13 | use JSON; |
eb1c51c2 DM |
14 | use utf8; |
15 | use Encode; | |
f53ad23a | 16 | |
5e287f60 DM |
17 | sub render_timestamp { |
18 | my ($epoch) = @_; | |
19 | ||
20 | # ISO 8601 date format | |
21 | return strftime("%F %H:%M:%S", localtime($epoch)); | |
22 | } | |
23 | ||
24 | PVE::JSONSchema::register_renderer('timestamp', \&render_timestamp); | |
25 | ||
e735d7b0 DM |
26 | sub render_timestamp_gmt { |
27 | my ($epoch) = @_; | |
28 | ||
29 | # ISO 8601 date format, standard Greenwich time zone | |
30 | return strftime("%F %H:%M:%S", gmtime($epoch)); | |
31 | } | |
32 | ||
33 | PVE::JSONSchema::register_renderer('timestamp_gmt', \&render_timestamp_gmt); | |
34 | ||
f495c868 DM |
35 | sub render_duration { |
36 | my ($duration_in_seconds) = @_; | |
37 | ||
38 | my $text = ''; | |
39 | my $rest = $duration_in_seconds; | |
40 | ||
41 | my $step = sub { | |
42 | my ($unit, $unitlength) = @_; | |
43 | ||
44 | if ((my $v = int($rest/$unitlength)) > 0) { | |
45 | $text .= " " if length($text); | |
46 | $text .= "${v}${unit}"; | |
47 | $rest -= $v * $unitlength; | |
48 | } | |
49 | }; | |
50 | ||
51 | $step->('w', 7*24*3600); | |
52 | $step->('d', 24*3600); | |
53 | $step->('h', 3600); | |
54 | $step->('m', 60); | |
55 | $step->('s', 1); | |
56 | ||
57 | return $text; | |
58 | } | |
59 | ||
60 | PVE::JSONSchema::register_renderer('duration', \&render_duration); | |
61 | ||
62 | sub render_fraction_as_percentage { | |
63 | my ($fraction) = @_; | |
64 | ||
65 | return sprintf("%.2f%%", $fraction*100); | |
66 | } | |
67 | ||
68 | PVE::JSONSchema::register_renderer( | |
69 | 'fraction_as_percentage', \&render_fraction_as_percentage); | |
70 | ||
71 | sub render_bytes { | |
72 | my ($value) = @_; | |
73 | ||
74 | my @units = qw(B KiB MiB GiB TiB PiB); | |
75 | ||
76 | my $max_unit = 0; | |
77 | if ($value > 1023) { | |
78 | $max_unit = int(log($value)/log(1024)); | |
79 | $value /= 1024**($max_unit); | |
80 | } | |
3496d4bf DM |
81 | my $unit = $units[$max_unit]; |
82 | return sprintf "%.2f $unit", $value; | |
f495c868 DM |
83 | } |
84 | ||
85 | PVE::JSONSchema::register_renderer('bytes', \&render_bytes); | |
86 | ||
ba752c80 DM |
87 | sub render_yaml { |
88 | my ($value) = @_; | |
89 | ||
90 | my $data = CPAN::Meta::YAML::Dump($value); | |
91 | $data =~ s/^---[\n\s]//; # remove yaml marker | |
92 | ||
93 | return $data; | |
94 | } | |
95 | ||
96 | PVE::JSONSchema::register_renderer('yaml', \&render_yaml); | |
97 | ||
4ac85000 DM |
98 | sub query_terminal_options { |
99 | my ($options) = @_; | |
100 | ||
101 | $options //= {}; | |
102 | ||
103 | if (-t STDOUT) { | |
104 | ($options->{columns}) = PVE::PTY::tcgetsize(*STDOUT); | |
105 | } | |
106 | ||
107 | $options->{encoding} = I18N::Langinfo::langinfo(I18N::Langinfo::CODESET()); | |
108 | ||
109 | $options->{utf8} = 1 if $options->{encoding} eq 'UTF-8'; | |
110 | ||
111 | return $options; | |
112 | } | |
113 | ||
f53ad23a | 114 | sub data_to_text { |
b01a09e7 | 115 | my ($data, $propdef, $options, $terminal_opts) = @_; |
f53ad23a | 116 | |
3cd6f2f3 DM |
117 | return '' if !defined($data); |
118 | ||
b01a09e7 DM |
119 | $terminal_opts //= {}; |
120 | ||
352b7a14 DM |
121 | my $human_readable = $options->{'human-readable'} // 1; |
122 | ||
123 | if ($human_readable && defined($propdef)) { | |
84142f1d DM |
124 | if (my $type = $propdef->{type}) { |
125 | if ($type eq 'boolean') { | |
126 | return $data ? 1 : 0; | |
127 | } | |
128 | } | |
129 | if (!defined($data) && defined($propdef->{default})) { | |
130 | return "($propdef->{default})"; | |
131 | } | |
132 | if (defined(my $renderer = $propdef->{renderer})) { | |
133 | my $code = PVE::JSONSchema::get_renderer($renderer); | |
134 | die "internal error: unknown renderer '$renderer'" if !$code; | |
b01a09e7 | 135 | return $code->($data, $options, $terminal_opts); |
84142f1d DM |
136 | } |
137 | } | |
f53ad23a DM |
138 | |
139 | if (my $class = ref($data)) { | |
b51b930d DM |
140 | # JSON::PP::Boolean requires allow_nonref |
141 | return to_json($data, { allow_nonref => 1, canonical => 1 }); | |
f53ad23a DM |
142 | } else { |
143 | return "$data"; | |
144 | } | |
145 | } | |
146 | ||
147 | # prints a formatted table with a title row. | |
148 | # $data - the data to print (array of objects) | |
149 | # $returnprops -json schema property description | |
150 | # $props_to_print - ordered list of properties to print | |
0c22b00c | 151 | # $options |
2e2a4502 | 152 | # - sort_key: can be used to sort after a specific column, if it isn't set we sort |
f53ad23a | 153 | # after the leftmost column (with no undef value in $data) this can be |
0c22b00c | 154 | # turned off by passing 0 as sort_key |
352b7a14 DM |
155 | # - noborder: print without asciiart border |
156 | # - noheader: print without table header | |
0c22b00c DM |
157 | # - columns: limit output width (if > 0) |
158 | # - utf8: use utf8 characters for table delimiters | |
159 | ||
f53ad23a | 160 | sub print_text_table { |
b01a09e7 DM |
161 | my ($data, $returnprops, $props_to_print, $options, $terminal_opts) = @_; |
162 | ||
163 | $terminal_opts //= query_terminal_options({}); | |
0c22b00c DM |
164 | |
165 | my $sort_key = $options->{sort_key}; | |
352b7a14 DM |
166 | my $border = !$options->{noborder}; |
167 | my $header = !$options->{noheader}; | |
b01a09e7 DM |
168 | |
169 | my $columns = $terminal_opts->{columns}; | |
170 | my $utf8 = $terminal_opts->{utf8}; | |
171 | my $encoding = $terminal_opts->{encoding} // 'UTF-8'; | |
f53ad23a | 172 | |
2e2a4502 | 173 | $sort_key //= $props_to_print->[0]; |
41d554d9 | 174 | |
2e2a4502 | 175 | if (defined($sort_key) && $sort_key ne 0) { |
41d554d9 DM |
176 | my $type = $returnprops->{$sort_key}->{type} // 'string'; |
177 | if ($type eq 'integer' || $type eq 'number') { | |
178 | @$data = sort { $a->{$sort_key} <=> $b->{$sort_key} } @$data; | |
179 | } else { | |
180 | @$data = sort { $a->{$sort_key} cmp $b->{$sort_key} } @$data; | |
181 | } | |
f53ad23a DM |
182 | } |
183 | ||
184 | my $colopts = {}; | |
793ad69b | 185 | |
eb1c51c2 DM |
186 | my $borderstring_m = ''; |
187 | my $borderstring_b = ''; | |
188 | my $borderstring_t = ''; | |
9e3aaec4 | 189 | my $borderstring_h = ''; |
f53ad23a DM |
190 | my $formatstring = ''; |
191 | ||
192 | my $column_count = scalar(@$props_to_print); | |
193 | ||
41d554d9 DM |
194 | my $tabledata = []; |
195 | ||
196 | foreach my $entry (@$data) { | |
197 | ||
198 | my $height = 1; | |
199 | my $rowdata = {}; | |
200 | ||
201 | for (my $i = 0; $i < $column_count; $i++) { | |
202 | my $prop = $props_to_print->[$i]; | |
203 | my $propinfo = $returnprops->{$prop} // {}; | |
204 | ||
b01a09e7 | 205 | my $text = data_to_text($entry->{$prop}, $propinfo, $options, $terminal_opts); |
41d554d9 DM |
206 | my $lines = [ split(/\n/, $text) ]; |
207 | my $linecount = scalar(@$lines); | |
208 | $height = $linecount if $linecount > $height; | |
209 | ||
210 | my $width = 0; | |
211 | foreach my $line (@$lines) { | |
212 | my $len = length($line); | |
213 | $width = $len if $len > $width; | |
214 | } | |
215 | ||
b9474c96 DM |
216 | $width = ($width =~ m/^(\d+)$/) ? int($1) : 0; # untaint int |
217 | ||
41d554d9 DM |
218 | $rowdata->{$prop} = { |
219 | lines => $lines, | |
220 | width => $width, | |
221 | }; | |
222 | } | |
223 | ||
224 | push @$tabledata, { | |
225 | height => $height, | |
226 | rowdata => $rowdata, | |
227 | }; | |
228 | } | |
229 | ||
f53ad23a DM |
230 | for (my $i = 0; $i < $column_count; $i++) { |
231 | my $prop = $props_to_print->[$i]; | |
232 | my $propinfo = $returnprops->{$prop} // {}; | |
2ec79c0f DM |
233 | my $type = $propinfo->{type} // 'string'; |
234 | my $alignstr = ($type eq 'integer' || $type eq 'number') ? '' : '-'; | |
f53ad23a DM |
235 | |
236 | my $title = $propinfo->{title} // $prop; | |
237 | my $cutoff = $propinfo->{print_width} // $propinfo->{maxLength}; | |
238 | ||
239 | # calculate maximal print width and cutoff | |
240 | my $titlelen = length($title); | |
241 | ||
242 | my $longest = $titlelen; | |
41d554d9 DM |
243 | foreach my $coldata (@$tabledata) { |
244 | my $rowdata = $coldata->{rowdata}->{$prop}; | |
245 | $longest = $rowdata->{width} if $rowdata->{width} > $longest; | |
f53ad23a DM |
246 | } |
247 | $cutoff = $longest if !defined($cutoff) || $cutoff > $longest; | |
f53ad23a DM |
248 | |
249 | $colopts->{$prop} = { | |
250 | title => $title, | |
f53ad23a DM |
251 | cutoff => $cutoff, |
252 | }; | |
253 | ||
793ad69b | 254 | if ($border) { |
eb1c51c2 DM |
255 | if ($i == 0 && ($column_count == 1)) { |
256 | if ($utf8) { | |
2ec79c0f | 257 | $formatstring .= "│ %$alignstr${cutoff}s │"; |
41d554d9 | 258 | $borderstring_t .= "┌─" . ('─' x $cutoff) . "─┐"; |
9e3aaec4 | 259 | $borderstring_h .= "╞═" . ('═' x $cutoff) . '═╡'; |
41d554d9 DM |
260 | $borderstring_m .= "├─" . ('─' x $cutoff) . "─┤"; |
261 | $borderstring_b .= "└─" . ('─' x $cutoff) . "─┘"; | |
eb1c51c2 | 262 | } else { |
2ec79c0f | 263 | $formatstring .= "| %$alignstr${cutoff}s |"; |
41d554d9 | 264 | $borderstring_m .= "+-" . ('-' x $cutoff) . "-+"; |
9e3aaec4 | 265 | $borderstring_h .= "+=" . ('=' x $cutoff) . '='; |
eb1c51c2 DM |
266 | } |
267 | } elsif ($i == 0) { | |
268 | if ($utf8) { | |
2ec79c0f | 269 | $formatstring .= "│ %$alignstr${cutoff}s "; |
eb1c51c2 | 270 | $borderstring_t .= "┌─" . ('─' x $cutoff) . '─'; |
9e3aaec4 | 271 | $borderstring_h .= "╞═" . ('═' x $cutoff) . '═'; |
eb1c51c2 DM |
272 | $borderstring_m .= "├─" . ('─' x $cutoff) . '─'; |
273 | $borderstring_b .= "└─" . ('─' x $cutoff) . '─'; | |
274 | } else { | |
2ec79c0f | 275 | $formatstring .= "| %$alignstr${cutoff}s "; |
eb1c51c2 | 276 | $borderstring_m .= "+-" . ('-' x $cutoff) . '-'; |
9e3aaec4 | 277 | $borderstring_h .= "+=" . ('=' x $cutoff) . '='; |
eb1c51c2 DM |
278 | } |
279 | } elsif ($i == ($column_count - 1)) { | |
280 | if ($utf8) { | |
2ec79c0f | 281 | $formatstring .= "│ %$alignstr${cutoff}s │"; |
41d554d9 | 282 | $borderstring_t .= "┬─" . ('─' x $cutoff) . "─┐"; |
9e3aaec4 | 283 | $borderstring_h .= "╪═" . ('═' x $cutoff) . '═╡'; |
41d554d9 DM |
284 | $borderstring_m .= "┼─" . ('─' x $cutoff) . "─┤"; |
285 | $borderstring_b .= "┴─" . ('─' x $cutoff) . "─┘"; | |
eb1c51c2 | 286 | } else { |
2ec79c0f | 287 | $formatstring .= "| %$alignstr${cutoff}s |"; |
41d554d9 | 288 | $borderstring_m .= "+-" . ('-' x $cutoff) . "-+"; |
9e3aaec4 | 289 | $borderstring_h .= "+=" . ('=' x $cutoff) . "=+"; |
eb1c51c2 | 290 | } |
793ad69b | 291 | } else { |
eb1c51c2 | 292 | if ($utf8) { |
2ec79c0f | 293 | $formatstring .= "│ %$alignstr${cutoff}s "; |
eb1c51c2 | 294 | $borderstring_t .= "┬─" . ('─' x $cutoff) . '─'; |
9e3aaec4 | 295 | $borderstring_h .= "╪═" . ('═' x $cutoff) . '═'; |
eb1c51c2 DM |
296 | $borderstring_m .= "┼─" . ('─' x $cutoff) . '─'; |
297 | $borderstring_b .= "┴─" . ('─' x $cutoff) . '─'; | |
298 | } else { | |
2ec79c0f | 299 | $formatstring .= "| %$alignstr${cutoff}s "; |
eb1c51c2 | 300 | $borderstring_m .= "+-" . ('-' x $cutoff) . '-'; |
9e3aaec4 | 301 | $borderstring_h .= "+=" . ('=' x $cutoff) . '='; |
eb1c51c2 | 302 | } |
793ad69b DM |
303 | } |
304 | } else { | |
305 | # skip alignment and cutoff on last column | |
2ec79c0f | 306 | $formatstring .= ($i == ($column_count - 1)) ? "%s" : "%$alignstr${cutoff}s "; |
f53ad23a DM |
307 | } |
308 | } | |
309 | ||
eb1c51c2 DM |
310 | $borderstring_t = $borderstring_m if !length($borderstring_t); |
311 | $borderstring_b = $borderstring_m if !length($borderstring_b); | |
312 | ||
41d554d9 DM |
313 | my $writeln = sub { |
314 | my ($text) = @_; | |
315 | ||
316 | if ($columns) { | |
317 | print encode($encoding, substr($text, 0, $columns) . "\n"); | |
318 | } else { | |
319 | print encode($encoding, $text) . "\n"; | |
320 | } | |
321 | }; | |
322 | ||
323 | $writeln->($borderstring_t) if $border; | |
793ad69b | 324 | |
9e3aaec4 | 325 | my $borderstring_sep; |
352b7a14 DM |
326 | if ($header) { |
327 | my $text = sprintf $formatstring, map { $colopts->{$_}->{title} } @$props_to_print; | |
328 | $writeln->($text); | |
9e3aaec4 WB |
329 | $borderstring_sep = $borderstring_h; |
330 | } else { | |
331 | $borderstring_sep = $borderstring_m; | |
352b7a14 DM |
332 | } |
333 | ||
334 | for (my $i = 0; $i < scalar(@$tabledata); $i++) { | |
335 | my $coldata = $tabledata->[$i]; | |
336 | ||
9e3aaec4 WB |
337 | if ($border && ($i != 0 || $header)) { |
338 | $writeln->($borderstring_sep); | |
339 | $borderstring_sep = $borderstring_m; | |
340 | } | |
41d554d9 DM |
341 | |
342 | for (my $i = 0; $i < $coldata->{height}; $i++) { | |
343 | ||
352b7a14 | 344 | my $text = sprintf $formatstring, map { |
41d554d9 DM |
345 | substr($coldata->{rowdata}->{$_}->{lines}->[$i] // '', 0, $colopts->{$_}->{cutoff}); |
346 | } @$props_to_print; | |
347 | ||
348 | $writeln->($text); | |
349 | } | |
f53ad23a | 350 | } |
41d554d9 DM |
351 | |
352 | $writeln->($borderstring_b) if $border; | |
f53ad23a DM |
353 | } |
354 | ||
c5adc5f9 DM |
355 | sub extract_properties_to_print { |
356 | my ($propdef) = @_; | |
357 | ||
358 | my $required = []; | |
359 | my $optional = []; | |
360 | ||
361 | foreach my $key (keys %$propdef) { | |
362 | my $prop = $propdef->{$key}; | |
363 | if ($prop->{optional}) { | |
364 | push @$optional, $key; | |
365 | } else { | |
366 | push @$required, $key; | |
367 | } | |
368 | } | |
369 | ||
370 | return [ sort(@$required), sort(@$optional) ]; | |
371 | } | |
372 | ||
f53ad23a DM |
373 | # prints the result of an API GET call returning an array as a table. |
374 | # takes formatting information from the results property of the call | |
375 | # if $props_to_print is provided, prints only those columns. otherwise | |
376 | # takes all fields of the results property, with a fallback | |
fb3a1b29 | 377 | # to all fields occurring in items of $data. |
f53ad23a | 378 | sub print_api_list { |
b01a09e7 | 379 | my ($data, $result_schema, $props_to_print, $options, $terminal_opts) = @_; |
f53ad23a DM |
380 | |
381 | die "can only print object lists\n" | |
382 | if !($result_schema->{type} eq 'array' && $result_schema->{items}->{type} eq 'object'); | |
383 | ||
384 | my $returnprops = $result_schema->{items}->{properties}; | |
385 | ||
c5adc5f9 DM |
386 | $props_to_print = extract_properties_to_print($returnprops) |
387 | if !defined($props_to_print); | |
388 | ||
389 | if (!scalar(@$props_to_print)) { | |
390 | my $all_props = {}; | |
391 | foreach my $obj (@$data) { | |
392 | foreach my $key (keys %$obj) { | |
393 | $all_props->{$key} = 1; | |
f53ad23a | 394 | } |
f53ad23a | 395 | } |
c5adc5f9 | 396 | $props_to_print = [ sort keys %{$all_props} ]; |
f53ad23a DM |
397 | } |
398 | ||
c5adc5f9 DM |
399 | die "unable to detect list properties\n" if !scalar(@$props_to_print); |
400 | ||
b01a09e7 | 401 | print_text_table($data, $returnprops, $props_to_print, $options, $terminal_opts); |
f53ad23a DM |
402 | } |
403 | ||
b51b930d DM |
404 | my $guess_type = sub { |
405 | my $data = shift; | |
406 | ||
407 | return 'null' if !defined($data); | |
408 | ||
409 | my $class = ref($data); | |
410 | return 'string' if !$class; | |
411 | ||
412 | if ($class eq 'HASH') { | |
413 | return 'object'; | |
414 | } elsif ($class eq 'ARRAY') { | |
415 | return 'array'; | |
416 | } else { | |
417 | return 'string'; # better than nothing | |
418 | } | |
419 | }; | |
420 | ||
f53ad23a | 421 | sub print_api_result { |
b01a09e7 | 422 | my ($data, $result_schema, $props_to_print, $options, $terminal_opts) = @_; |
0c22b00c | 423 | |
352b7a14 DM |
424 | return if $options->{quiet}; |
425 | ||
b01a09e7 | 426 | $terminal_opts //= query_terminal_options({}); |
f53ad23a | 427 | |
4cbcd138 | 428 | my $format = $options->{'output-format'} // 'text'; |
f0bcf4d4 | 429 | |
fbd10e04 | 430 | if ($result_schema && defined($result_schema->{type})) { |
b51b930d | 431 | return if $result_schema->{type} eq 'null'; |
c0b8717c | 432 | return if $result_schema->{optional} && !defined($data); |
b51b930d DM |
433 | } else { |
434 | my $type = $guess_type->($data); | |
435 | $result_schema = { type => $type }; | |
436 | $result_schema->{items} = { type => $guess_type->($data->[0]) } if $type eq 'array'; | |
437 | } | |
f53ad23a | 438 | |
ac6c61bf DM |
439 | if ($format eq 'yaml') { |
440 | print encode('UTF-8', CPAN::Meta::YAML::Dump($data)); | |
441 | } elsif ($format eq 'json') { | |
cd6591d3 DM |
442 | # Note: we always use utf8 encoding for json format |
443 | print to_json($data, {utf8 => 1, allow_nonref => 1, canonical => 1 }) . "\n"; | |
444 | } elsif ($format eq 'json-pretty') { | |
43b104c4 | 445 | # Note: we always use utf8 encoding for json format |
f53ad23a | 446 | print to_json($data, {utf8 => 1, allow_nonref => 1, canonical => 1, pretty => 1 }); |
cd6591d3 | 447 | } elsif ($format eq 'text') { |
43b104c4 | 448 | my $encoding = $options->{encoding} // 'UTF-8'; |
f53ad23a DM |
449 | my $type = $result_schema->{type}; |
450 | if ($type eq 'object') { | |
c5adc5f9 DM |
451 | $props_to_print = extract_properties_to_print($result_schema->{properties}) |
452 | if !defined($props_to_print); | |
453 | $props_to_print = [ sort keys %$data ] if !scalar(@$props_to_print); | |
2a174d2a | 454 | my $kvstore = []; |
f53ad23a | 455 | foreach my $key (@$props_to_print) { |
a05db8b5 | 456 | next if !defined($data->{$key}); |
b01a09e7 | 457 | push @$kvstore, { key => $key, value => data_to_text($data->{$key}, $result_schema->{properties}->{$key}, $options, $terminal_opts) }; |
f53ad23a | 458 | } |
2a174d2a | 459 | my $schema = { type => 'array', items => { type => 'object' }}; |
b01a09e7 | 460 | print_api_list($kvstore, $schema, ['key', 'value'], $options, $terminal_opts); |
f53ad23a DM |
461 | } elsif ($type eq 'array') { |
462 | return if !scalar(@$data); | |
463 | my $item_type = $result_schema->{items}->{type}; | |
464 | if ($item_type eq 'object') { | |
b01a09e7 | 465 | print_api_list($data, $result_schema, $props_to_print, $options, $terminal_opts); |
f53ad23a | 466 | } else { |
c850b998 DM |
467 | my $kvstore = []; |
468 | foreach my $value (@$data) { | |
469 | push @$kvstore, { value => $value }; | |
f53ad23a | 470 | } |
c850b998 | 471 | my $schema = { type => 'array', items => { type => 'object', properties => { value => $result_schema->{items} }}}; |
b01a09e7 | 472 | print_api_list($kvstore, $schema, ['value'], { %$options, noheader => 1 }, $terminal_opts); |
f53ad23a DM |
473 | } |
474 | } else { | |
43b104c4 | 475 | print encode($encoding, "$data\n"); |
f53ad23a DM |
476 | } |
477 | } else { | |
478 | die "internal error: unknown output format"; # should not happen | |
479 | } | |
480 | } | |
481 | ||
6bc09493 DM |
482 | sub print_api_result_plain { |
483 | my ($data, $result_schema, $props_to_print, $options) = @_; | |
484 | ||
485 | # avoid borders and header, ignore terminal width | |
486 | $options = $options ? { %$options } : {}; # copy | |
487 | ||
488 | $options->{noheader} //= 1; | |
489 | $options->{noborder} //= 1; | |
490 | ||
491 | print_api_result($data, $result_schema, $props_to_print, $options, {}); | |
492 | } | |
493 | ||
f53ad23a | 494 | 1; |