Skip site navigation (1) Skip section navigation (2)

Re: pg_dump.options.diff

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Serguei Mokhov" <mokhov(at)cs(dot)concordia(dot)ca>
Cc: "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>,"Peter Eisentraut" <peter_e(at)gmx(dot)net>
Subject: Re: pg_dump.options.diff
Date: 2003-01-02 06:34:23
Message-ID: 18064.1041489263@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
"Serguei Mokhov" <mokhov(at)cs(dot)concordia(dot)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_LONG
	char* 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_LONG
	printf(_("  -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

In response to

Responses

pgsql-hackers by date

Next:From: Christopher Kings-LynneDate: 2003-01-02 06:43:15
Subject: Re: Cast your vote ...
Previous:From: Marc G. FournierDate: 2003-01-02 06:24:34
Subject: Cast your vote ...

pgsql-patches by date

Next:From: Serguei MokhovDate: 2003-01-02 06:44:21
Subject: Re: pg_dump.options.diff
Previous:From: Serguei MokhovDate: 2003-01-02 06:16:58
Subject: pg_dump.options.diff

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group