[darcs-devel] darcs patch: Added "darcs show repo" command to display repository ...

David Roundy droundy at darcs.net
Wed Nov 21 13:57:41 UTC 2007


On Tue, Nov 20, 2007 at 10:54:08PM -0700, Kevin Quick wrote:
> Issues I didn't simply change:
> 
> >> +-- labelled strings: labels are right-aligned at 14 characters;
> >> +-- subsequent lines in multi-line output are indented accordingly.
> >> +showInfoUsr :: ShowInfo
> >> +showInfoUsr t i = (replicate (14 - length(t)) ' ') ++ t ++ ": " ++
> >> +                  (concat $ intersperse ('\n' : (replicate 16 '  
> >> ')) $ lines i) ++ "\n"
> >
> > First, I'm not so keen on the fancy right-aligning code.  I realise
> > that it can be helpful for human readibility, but I wonder if we can
> > find something that's a little bit friendlier to future changes.  For
> > example, maybe we could just use a tab character?  The output is not
> > quite as nice-looking, but the underlying code is simpler.  I guess it
> > depends on whether you're more interested in people or third party
> > tools.
> 
> I tend to like the right-aligned labels and vertical alignment of  
> values because I do think it makes it more readable (my primary goal  
> is human interaction, although maintaining regularity of output for  
> tools is a close second).  I'm willing to cede to the group's wishes  
> on this issue, but I'd prefer something like the current  
> implementation for readability.  For this same reason, I prefer to  
> keep the capitalization of the labels, even though it requires an  
> extra function step for producing XML tags.
> 
> I hesitate to use tabs since it still requires counting and insertion  
> of variable numbers of tabs, and looks less table-like.
> 
> The code is a bit more complicated, but it's pretty self-contained.   
> I could extract the above to something more indicative of purpose  
> like "rightAlign", but since it only appears in one place, that  
> seemed superfluous.

Another option here would be to use and improve the Doc data type.  It's a
bit weird to deal with, but does some nice pretty-printing stuff.  I don't
think it does right-alignment, but if you added the code in there, it'd at
least be in the right bit of the code.  It'd also let you add color to the
format in a way that the user can configure (using existing configuration
options).

Just a suggestion for an alternate refactoring route.  Thanks for this
contribution!
-- 
David Roundy
Department of Physics
Oregon State University


More information about the darcs-devel mailing list