From 230cc2f50b72e7e423eba93a6ba87e92850b752b Mon Sep 17 00:00:00 2001
From: nott <nott@8638fb3e-16cb-4fca-ae20-7b5d299a9bcd>
Date: Tue, 29 Jul 2008 17:43:47 +0000
Subject: [PATCH] make lsdef help output alphabetical

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1956 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
---
 xCAT-server/lib/xcat/plugins/DBobjectdefs.pm | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm
index c45f1e106..4272b3246 100644
--- a/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm
+++ b/xCAT-server/lib/xcat/plugins/DBobjectdefs.pm
@@ -454,13 +454,16 @@ sub processArgs
             $rsp->{data}->[1] = "Attribute          Description\n";
 
             my @alreadydone;    # the same attr may appear more then once
+			my @attrlist;
             my $outstr = "";
 
             foreach my $this_attr (@{$datatype->{'attrs'}})
             {
                 my $attr = $this_attr->{attr_name};
                 my $desc = $this_attr->{description};
-                if (!defined($desc)) {     # description key not there, so go to the corresponding entry in tabspec to get the description
+                if (!defined($desc)) {     
+					# description key not there, so go to the corresponding 
+					#	entry in tabspec to get the description
                 	my ($tab, $at) = split(/\./, $this_attr->{tabentry});
                 	my $schema = xCAT::Table->getTableSchema($tab);
                 	$desc = $schema->{descriptions}->{$at};
@@ -472,15 +475,17 @@ sub processArgs
 
                 if (!grep(/^$attr$/, @alreadydone))
                 {
-                #    $outstr .= "$attr\n\t\t- $desc \n\t\t(Table: $tab)\n\n";
-					#$outstr .= "$attr\n\t\t- $desc\n\n";
 					my $space = (length($attr)<7 ? "\t\t" : "\t");
-					$outstr .= "$attr:$space$desc\n\n";
+					push(@attrlist, "$attr:$space$desc\n\n");
                 }
                 push(@alreadydone, $attr);
             }
 
-			chop($outstr);  chop($outstr);
+			# print the output in alphabetical order
+            foreach my $a (sort @attrlist) {
+                $outstr .= "$a";
+            }
+            chop($outstr);  chop($outstr);
             $rsp->{data}->[2] = $outstr;
 
 			# the monitoring table is  special