Attached is a patch which I think fixes the problems in the help text parsing.
I've tweaked the way the optional arguments are parsed to allow the '>' character inside the [], this fixes "fs setcachesize" and "fs precache".
I also dropped the unnecessary '?' after the \w+ used in each regexp for the option name, this made it excessively non-greedy in some cases. This fixes the "fs uuid" problem.
I've checked through all current commands and operations and my changes seem to work correctly but clearly this code will always be a little fragile since it relies on the openafs commands generating well-formed help text.
Stephen
On Mon Nov 24 07:00:15 2014, SJQUINNEY wrote:
Show quoted text> Further to this, the same problem affects the "fs precache" command:
>
> /usr/bin/fs precache [-blocks <size in 1K byte blocks (0 => disable)>]
> [-help]
>
> To check for other problems with the help text parsing, I've now been
> through all of the operations for fs, bos, vos and pts commands and
> discovered there's a further different problem with "fs uuid":
>
> /usr/bin/fs uuid -generate [-help]
>
> I'll take a look at the _arguments subroutine in AFS::Command::Base
> and see if I can come up with a suitable patch.
>
>
> Stephen
>
>
> On Fri Nov 21 12:08:16 2014, SJQUINNEY wrote:
> > When I try to use the setcachesize method in AFS::Command::FS it
> > fails
> > to parse the argument list:
> >
> > unable to parse fs help for setcachesize
> > Unrecognized string: '[-blocks <size in 1K byte blocks (0 => reset)>]
> > [-reset] [-help]
> >
> > The help text on my machine with 1.6.10 installed gives:
> >
> > % fs help setcachesize
> > fs setcachesize: set cache size
> > aliases: cachesize
> > Usage: fs setcachesize [-blocks <size in 1K byte blocks (0 =>
> > reset)>]
> > [-reset] [-help]
> > Where: -reset reset size back to boot value