[pve-devel] [PATCH common] get_options: allow optional arguments "arg_params" if no ambiguity

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Aug 27 08:39:06 CEST 2020

On 27.08.20 06:22, Dietmar Maurer wrote:
>> If we run out of passed arguments from the user but still had defined
>> "arg_params" (those params which went after the command in fixed
>> order without option -- dashes) we always errored out with "not
>> enough arguments". But, there are situations where the remaining
>> arg_params are all marked as optional in the schema, so we do not
>> need to error out in that case.
> Ok for me, but
>> A prime (future) use case is "pvesm prune-backups". Currently the
>> usage is:
>>> pvesm prune-backups storeid --prune-backups keep-last=1,keep-...
> I would like to have a different CLI for that:
> pvesm prune-backups storeid --keep-last 2 --keep-weekly 5
> any opinions?

Fine for me!

@Fabi, can you take a look at this?

Effectively we just need to use the 'prune-backups' format defiinitions
$prune_backups_format hash from Storage::Plugin directly as parameter,
then we can map and pass it along to the helper.

More information about the pve-devel mailing list