lib/aka.rb in aka-0.5.8 vs lib/aka.rb in aka-0.6.0

- old
+ new

@@ -55,11 +55,18 @@ @aliases.keys.each{|key| keyList = keyList+" #{key}" } info(keyList) end def showAll - keyList = "" - @aliases.each{|key, value| keyList = keyList + "#{key}: #{value}\n"} + # A whole bunch of rigamarole to make all the line items the same width. + length = 0 + @aliases.keys.each do |k| + length = k.length if k.length > length + end + eq_string = "=" * (length + 7) #7 is the length of the string ": Value" + length = length * -1 + keyList = sprintf("\n\n%1$*2$s: %3$s\n%4$s\n","Alias",length,"Value",eq_string) + @aliases.each{|key, value| keyList = keyList + sprintf("%1$*2$s: %3$s\n",key, length, value)} info keyList end def show string info(@aliases[string]) \ No newline at end of file