darcs

Patch 807 Add new 'usageInfo' implementation (Darcs.Usage); empl...

Title Add new 'usageInfo' implementation (Darcs.Usage); empl...
Superseder Nosy List marc
Related Issues
Status accepted Assigned To marc
Milestone

Created on 2012-04-22.09:57:04 by marc, last changed 2012-05-12.21:39:28 by gh.

Files
File name Status Uploaded Type Edit Remove
add-new-_usageinfo_-implementation-_darcs_usage__-employ-in-darcs_command_.dpatch marc, 2012-04-22.09:57:03 application/x-darcs-patch
patch-preview.txt marc, 2012-04-22.09:57:03 text/x-darcs-patch
unnamed marc, 2012-04-22.09:57:03
See mailing list archives for discussion on individual patches.
Messages
msg15595 (view) Author: marc Date: 2012-04-22.09:57:03
Summary
-------

This module provides a variant of 'System.Console.GetOpt.usageInfo' in the
module 'Darcs.Usage'.

The new 'usageInfo' definition is employed in 'Darcs.Commands' to break long
switches across multiple lines, economising on columns.

Before applying this patch, help output resembles the following,

$ darcs pull -h
[...]
         --dont-allow-conflicts, --no-allow-conflicts           fail if...

With the patch, these switches are presented on separate lines,

$ darcs pull -h
[...]
         --dont-allow-conflicts,
         --no-allow-conflicts            fail if...

Future improvements might include wrapping switch descriptions when they
overflow the right margin (e.g., at 80 characters).

Patch
-----

1 patch for repository http://darcs.net/screened:

Sat Apr 21 18:39:24 BST 2012  Marc Simpson <marc@0branch.com>
  * Add new 'usageInfo' implementation (Darcs.Usage); employ in Darcs.Command.
Attachments
msg15607 (view) Author: kowey Date: 2012-04-22.22:18:09
Seems fairly reasonable, not really reviewed, but I think I more or less 
understand what's going on.

UI-wise, this might be a bit confusing.  I wonder if
         --dont-allow-conflicts,
         --no-allow-conflicts            fail if...

Needs to be maybe vertically aligned with the top rather than bottom.
Perhaps we could establish a convention where one of these is displayed 
and the others are just hidden from help?  (ie. just there for backwards 
compatibility?  In the above case, we probably want to keep no-allow-
conflicts

Marc, things to address in a follow-up patch before we push this to 
reviewed (I'm pushing this to screened, ie. http://darcs.net though):
- hlint (if not already)
- coding style, see http://wiki.darcs.net/Development/CodingStyle 
(there's a link to a GitHub page with indentation conventions, etc)
- perhaps nuke some partial functions if there's a sane way to do it 
(last, init, head).  It's low risk here — the worst is darcs help blows 
up — but in general I like to avoid them if I can.  Any way we can 
improve that?
- I think replace sepBy and maybe unlines' with some use of intercalate 
or intersperse?
- Copyright header (may need to grab from GetOpt code)

(And thanks for the haddocked code!)
msg15680 (view) Author: gh Date: 2012-05-12.21:39:28
I'm OK with the code of the module and the vertical alignment choice.

The only thing that may bother me is the lack of copyright header, but
the existing codebase is not exactly exemplary either. Marc, please have
a look at the discussions at http://bugs.darcs.net/patch704 and submit a
header for Darcs.Usage before someone sticks a generic GPL header. 
Accepting it.
History
Date User Action Args
2012-04-22 09:57:04marccreate
2012-04-22 22:18:10koweysetstatus: needs-screening -> needs-review
messages: + msg15607
2012-05-10 07:30:09galbollesetstatus: needs-review -> followup-requested
assignedto: marc
2012-05-12 21:39:28ghsetstatus: followup-requested -> accepted
messages: + msg15680