[pve-devel] r6391 - in pve-common/trunk/data: . PVE

svn-commits at proxmox.com svn-commits at proxmox.com
Tue Aug 2 06:45:24 CEST 2011


Author: dietmar
Date: 2011-08-02 06:45:24 +0200 (Tue, 02 Aug 2011)
New Revision: 6391

Modified:
   pve-common/trunk/data/ChangeLog
   pve-common/trunk/data/PVE/CLIHandler.pm
Log:
	* PVE/CLIHandler.pm (handle_cmd): auto-complete commands



Modified: pve-common/trunk/data/ChangeLog
===================================================================
--- pve-common/trunk/data/ChangeLog	2011-08-01 11:36:41 UTC (rev 6390)
+++ pve-common/trunk/data/ChangeLog	2011-08-02 04:45:24 UTC (rev 6391)
@@ -1,3 +1,7 @@
+2011-08-02  Proxmox Support Team  <support at proxmox.com>
+
+	* PVE/CLIHandler.pm (handle_cmd): auto-complete commands
+
 2011-07-28  Proxmox Support Team  <support at proxmox.com>
 
 	* PVE/JSONSchema.pm (get_standard_option): register option

Modified: pve-common/trunk/data/PVE/CLIHandler.pm
===================================================================
--- pve-common/trunk/data/PVE/CLIHandler.pm	2011-08-01 11:36:41 UTC (rev 6390)
+++ pve-common/trunk/data/PVE/CLIHandler.pm	2011-08-02 04:45:24 UTC (rev 6391)
@@ -115,6 +115,21 @@
 	exit (-1);
     }
 
+     if (!$cmddef->{$cmd}) {
+	my $expanded;
+	for my $k (keys(%$cmddef)) {
+	    if ($k =~ m/^$cmd/) {
+		if ($expanded) {
+		    $expanded = undef; # more than one match
+		    last;
+		} else {
+		    $expanded = $k;
+		}
+	    }
+	}
+	$cmd = $expanded if $expanded;
+     }
+
     my ($class, $name, $arg_param, $uri_param, $outsub) = @{$cmddef->{$cmd}} if $cmddef->{$cmd};
 
     if (!$class) {




More information about the pve-devel mailing list