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

Fabian Ebner f.ebner at proxmox.com
Thu Aug 27 09:54:35 CEST 2020


Am 27.08.20 um 08:39 schrieb Thomas Lamprecht:
> 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.
> 

Yes, will do.





More information about the pve-devel mailing list