[PATCHv2] Re: Convert to use OptionParser for command line handling.
Sebastian at sspaeth.de
Wed Dec 15 17:39:41 GMT 2010
On Tue, 14 Dec 2010 21:43:35 -0500, Leif Walsh <leif.walsh at gmail.com> wrote:
> A quick thing: I would feel a lot more comfortable if offlineimap (the
> class) didn't parse the command line in its constructor. Instead, it should
> have an interface that accepts the options, or a command line string, or
> simply does nothing and requires you to call offlineimap.parse_commandline()
> after the object is constructed. This would make the object more useful in
> other contexts than as a glorified main(); I generally am put off by "magic"
A fair point. If I change the patch to parse command lines and run the
whole chebang in the .startup() function as we do now, would that be
acceptable to you? INvokation would then look something like
from offlineimap import OfflineImap
oi = OfflineImap()
oi.startup() <- parses cmd lines and does everything
Or what would be the preferred name for that? run(), start()?
Also, we would be able to hand in command line options to that function
(to e.g. simulate calling the whole biest from the command line with
some options), e.g.:
oi.startup('-c test.conf -f INBOX')
with the default being the real command line options being used.
Does this sound more sensible?
More information about the OfflineIMAP-project