[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: PATCH: process arguments in subcommands instead of main()

From: B. W. Fitzpatrick <fitz_at_red-bean.com>
Date: 2001-03-17 08:30:11 CET

Mo,

Excellent. I've applied your patch with the exception of the
SVN_ERR_ALREADY_PRINTED, which I had to whip up myself (you didn't
provide a patch to include/svn_error.h). This works very nicely, and I
nthink it's definitely more flexible than what we currently have.

I'm probably going to take the help strings out of main and put them
into the respective client files... there's no reason for it to be all
lumped together in main.

Cleaning up nicely...

-Fitz

> Here is a patch to implement processing of arguments in
> the subcommand instead of doing it all in main. The
> current approach of processing all the subcommand
> arguments in main() works, but it is a bit hard
> to get your brain around and I an not sure it will
> be flexible enough to deal with special cases or
> new subcommands that may be added in the future.
> Much of this was covered in earlier discussion on
> the list so I will not try to rehash it here.
>
> High level changes:
>
> 1. Removed num_args field from svn_cl__cmd_desc_t struct.
>
> 2. Changed svn_cl__cmd_proc_t signature to:
>
> (apr_getopt_t *, svn_cl__opt_state_t *, apr_pool_t *)
>
> 3. Processing or arguments is done in the subcommand.
>
> 4. Change svn_cl__help so that it will print
> the main program usage if NULL is passed in the
> first argument.
>
> 5. Subcommand help text is printed if the user passes
> an incorrect number of arguments.
>
> 6. Add a new error type SVN_ERR_ALREADY_PRINTED. When
> svn_handle_error() is called on this type of error
> it will print nothing and return.

This wasn't provided for in the patch, so I went ahead and hacked
something together.
 
> 7. Add "di" shortcut for diff subcommand to match
> the CVS implementation.
Received on Sat Oct 21 14:36:26 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.