On Sat, Jan 17, 2009 at 19:42:17 +1100, Trent W.Buck wrote: > Improved version of some stuff I sent yesterday. > > Sat Jan 17 12:55:05 EST 2009 Trent W. Buck <[email protected]> > * Simplify some of my own code. > > Sat Jan 17 19:15:33 EST 2009 Trent W. Buck <[email protected]> > * Refactor initial argument dispatcher.
Applied, thanks! Comment below Refactor initial argument dispatcher. ------------------------------------- > + argv <- getArgs > + case argv of > + -- User called "darcs" without arguments. > + [] -> print_version >> help_cmd [] [] > + -- User called "darcs --foo" for some special foo. > + ["-h"] -> help_cmd [] [] > + ["--help"] -> help_cmd [] [] > + ["--overview"] -> help_cmd [Verbose] [] > + ["--commands"] -> list_available_commands > + ["-v"] -> putStrLn darcs_version > + ["--version"] -> putStrLn darcs_version > + ["--exact-version"] -> do > + putStrLn $ "darcs compiled on "++__DATE__++", at "++__TIME__ > + putStrLn context Much nicer! Thanks for having the courage to risk a little code duplication for extra readability. Also, I think I understand now what was buggy in the previous edition of the patch (probably not news to you, as this version avoids the error): it made it so that a command line with only argument exists immediately, which is not what you want if your one argument is a command, e.g. darcs whatsnew Oops :-) I think both of us were mentally filtering the command out of argv. -- Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow> PGP Key ID: 08AC04F9
signature.asc
Description: Digital signature
_______________________________________________ darcs-users mailing list [email protected] http://lists.osuosl.org/mailman/listinfo/darcs-users
