Re: pg_dump.options.diff - Mailing list pgsql-hackers

From Tom Lane
Subject Re: pg_dump.options.diff
Date
Msg-id 18064.1041489263@sss.pgh.pa.us
Whole thread Raw
In response to pg_dump.options.diff  ("Serguei Mokhov" <mokhov@cs.concordia.ca>)
List pgsql-hackers
"Serguei Mokhov" <mokhov@cs.concordia.ca> writes:
> Attached is an attempt to eliminate duplicate pg_dump
> option descriptions, and have a single description for both
> short and long options. For me, as for a translator, this
> eliminates the need to maintain the two, exactly same, sets of 
> 24 sentences.

Offhand, this cure strikes me as much worse than the disease.  You've
converted code which was understandable, if somewhat repetitious, into
code that can be understood by neither programmers nor translators.
The text strings have been broken into fragments that don't make any
sense individually --- which probably creates translating problems,
as well as opportunities for programmer error.

I see your complaint, but this doesn't seem like a good way to fix it.

Perhaps it would work better to do something like

#ifdef HAVE_GETOPT_LONGchar* f_option = _("-f, --file=FILENAME     ");... etc ...
#else /* not HAVE_GETOPT_LONG */char* f_option = _("-f FILENAME             ");... etc ...
#endif /* not HAVE_GETOPT_LONG */
printf(_("  %s output file name\n"), f_option);... etc ...

That seems to reduce the amount of duplication without breaking things
up into chunks that aren't independent concepts.

However, I'm not convinced that the above is better than what we have
--- it's really not obvious that the above is more maintainable than

#ifdef HAVE_GETOPT_LONGprintf(_("  -f, --file=FILENAME      output file name\n"));
#else /* not HAVE_GETOPT_LONG */printf(_("  -f FILENAME              output file name\n"));
#endif /* not HAVE_GETOPT_LONG */

There are worse things than a little repetitiveness, and creating
the opportunity to mismatch a flag with its description may well
be one of them.

Comments?  Can anyone do better?
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: Cast your vote ...
Next
From: "Christopher Kings-Lynne"
Date:
Subject: Re: Cast your vote ...