public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [RFC proxmox 1/2] schema: print item type-text instead of <array>
@ 2021-09-15 13:36 Fabian Grünbichler
  2021-09-15 13:36 ` [pbs-devel] [RFC proxmox 2/2] schema: add extra info to array parameters Fabian Grünbichler
  2021-09-22  5:58 ` [pbs-devel] applied: [RFC proxmox 1/2] schema: print item type-text instead of <array> Thomas Lamprecht
  0 siblings, 2 replies; 4+ messages in thread
From: Fabian Grünbichler @ 2021-09-15 13:36 UTC (permalink / raw)
  To: pbs-devel

this is only used for CLI synopsis/usage strings, the API viewer already
prints the full type text in a correct format. the old variant was also
rather misleading, since on the CLI we don't pass in an array, but each
item as its own parameter.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
noticed this while working on the pull/sync filtering series, but it
affects quite a lot of stuff, among other things the Updater/Deleteable
CLI, e.g. from `man proxmox-backup-manager`:

       --delete <array>
                     List of properties to delete.

vs.

       --delete disable|validation-delay
                     List of properties to delete.

but some of them might only have <string> as the item type text, which
is not much nicer :-/

the whole "List of .." is confusing anyway, but not easily solvable,
since the description is used for
- API dump/viewer (where it is a list/array of ..)
- usage message/man pages (where it's a parameter that gives a single
  element, but it might be passed in multiple times to construct an
  array)

also for some common occurences, the item description is too generic,
and it's not possible to override the description for external types
with the current api macro.

 proxmox/src/api/format.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxmox/src/api/format.rs b/proxmox/src/api/format.rs
index 7f16e93..a362b21 100644
--- a/proxmox/src/api/format.rs
+++ b/proxmox/src/api/format.rs
@@ -120,7 +120,7 @@ pub fn get_schema_type_text(schema: &Schema, _style: ParameterDisplayStyle) -> S
             _ => String::from("<number>"),
         },
         Schema::Object(_) => String::from("<object>"),
-        Schema::Array(_) => String::from("<array>"),
+        Schema::Array(schema) => get_schema_type_text(schema.items, _style),
         Schema::AllOf(_) => String::from("<object>"),
     }
 }
-- 
2.30.2





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-22  6:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15 13:36 [pbs-devel] [RFC proxmox 1/2] schema: print item type-text instead of <array> Fabian Grünbichler
2021-09-15 13:36 ` [pbs-devel] [RFC proxmox 2/2] schema: add extra info to array parameters Fabian Grünbichler
2021-09-22  5:59   ` [pbs-devel] applied: " Thomas Lamprecht
2021-09-22  5:58 ` [pbs-devel] applied: [RFC proxmox 1/2] schema: print item type-text instead of <array> Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal