rhbz1110627 zanata init

https://bugzilla.redhat.com/show_bug.cgi?id=1110627
and https://bugzilla.redhat.com/show_bug.cgi?id=1038852

Depends on https://github.com/zanata/zanata-api/pull/15 and https://github.com/zanata/zanata-server/pull/520
Almost no gain but one extra layer of abstraction. Again unless we ditch strongly typed setter/getter and use reflection (or map), I don't think we can avoid this. 

----- Original Message -----

> From: "David Mason" <notifications@github.com>
> To: "zanata/zanata-client" <zanata-client@noreply.github.com>
> Cc: "Patrick Huang" <pahuang@redhat.com>
> Sent: Thursday, July 17, 2014 5:56:02 PM
> Subject: Re: [zanata-client] rhbz1110627 zanata init (#27)

> In
> zanata-client-commands/src/main/java/org/zanata/client/commands/OptionsUtil.java:
> > +            opts.setSrcDir(config.getSrcDirAsFile());
> > +        }
> > +        srcDirChecker.hintUserToUseConfig(
> > +                String.format("<src-dir>%s</src-dir>", opts.getSrcDir()));
> > +        srcDirChecker.warnUserForMismatch();
> > +
> > +        // apply transDir configuration
> > +        OptionMismatchChecker<File> transDirChecker =
> > OptionMismatchChecker
> > +                .from(opts.getTransDir(), config.getTransDirAsFile(),
> > +                        "Translation directory");
> > +        if (transDirChecker.hasValueInConfigOnly()) {
> > +            opts.setTransDir(config.getTransDirAsFile());
> > +        }
> > +        transDirChecker.hintUserToUseConfig(String.format(
> > +                "<trans-dir>%s</trans-dir>", opts.getTransDir()));
> > +        transDirChecker.warnUserForMismatch();

> Actually it looks like it is repeated below as well.

> Could we just have a superclass that does the control flow, and a subclass
> for each expected option that overrides functions for extracting their
> values from config/options and generating hints?

> —
> Reply to this email directly or view it on GitHub .