[pve-devel] [PATCH pve-common] auto completion: let class name and binary name differ

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Sep 14 17:32:05 CEST 2015



On 09/14/2015 04:57 PM, Dietmar Maurer wrote:
>
>> On September 14, 2015 at 2:15 PM Thomas Lamprecht <t.lamprecht at proxmox.com>
>> wrote:
>>
>>
>> Before this commit we assumed that the class name of an CLIHandler
>> derived class is equal to its executable name. This led to problems
>> when an cli executable name contained characters invalid for a class
>> name, e.g. an hyphen like ha-manager has.
>>
>> Now we distinguishes between class and binary names. A, from
>> CLIHandler derived, class can use:
>>
>> our exename = "...";
>>
>> to set an specific executable name used to generate pod and
>> autocompletion files. If this variable is not set we keep the
>> current behaviour and use the classname for exename.
>>
>> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
>> ---
>>   src/PVE/CLIHandler.pm | 40 ++++++++++++++++++++++++++++++----------
>>   1 file changed, 30 insertions(+), 10 deletions(-)
>>
>> diff --git a/src/PVE/CLIHandler.pm b/src/PVE/CLIHandler.pm
>> index e6fd415..4c29ed3 100644
>> --- a/src/PVE/CLIHandler.pm
>> +++ b/src/PVE/CLIHandler.pm
>> @@ -13,6 +13,7 @@ use base qw(PVE::RESTHandler);
>>   
>>   my $cmddef;
>>   my $exename;
>> +my $classname;
> Do we really need this additional var?
When generate_pod_manpage() calls find_cli_class_source() we need the 
class name, no matter if the derived class set an own exename.
But for this special case we could extract the class name once, a own 
variable isn't strictly necessary and seems like an overkill now.
will rethink and resend :)




More information about the pve-devel mailing list