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
It's not identical. The expression inside the if block and the hint message are different. Unless we use reflection (i.e. to replace that setter and getter call) I can't think of any way to extract that commonality. 
----- 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:49:58 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();

> Identical control flow is repeated twice here. Can it be abstracted out?

> —
> Reply to this email directly or view it on GitHub .