Marking options deprecated in help output

Started by Daniel Gustafssonabout 3 years ago3 messages
#1Daniel Gustafsson
daniel@yesql.se
1 attachment(s)

In the pg_dump blob terminology thread it was briefly discussed [0]95467596-834d-baa4-c67c-5db1096ed549@enterprisedb.com to mark
parameters as deprecated in the --help output. The attached is a quick diff to
show that that would look like. Personally I think it makes sense, not
everyone will read the docs.

--
Daniel Gustafsson https://vmware.com/

[0]: 95467596-834d-baa4-c67c-5db1096ed549@enterprisedb.com

Attachments:

deprecated_options.diffapplication/octet-stream; name=deprecated_options.diff; x-unix-mode=0644Download
diff --git a/contrib/oid2name/oid2name.c b/contrib/oid2name/oid2name.c
index 4edf02d9c7..66d8358bc0 100644
--- a/contrib/oid2name/oid2name.c
+++ b/contrib/oid2name/oid2name.c
@@ -216,8 +216,8 @@ help(const char *progname)
 		   "  -?, --help                 show this help, then exit\n"
 		   "\nConnection options:\n"
 		   "  -d, --dbname=DBNAME        database to connect to\n"
-		   "  -h, --host=HOSTNAME        database server host or socket directory\n"
-		   "  -H                         same as -h, deprecated option\n"
+		   "  -h, -H, --host=HOSTNAME    database server host or socket directory\n"
+		   "                             (-H is deprecated)\n"
 		   "  -p, --port=PORT            database server port number\n"
 		   "  -U, --username=USERNAME    connect as specified database user\n"
 		   "\nThe default action is to show all database OIDs.\n\n"
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index 37989ba567..311bd7ce96 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -339,7 +339,7 @@ help(const char *progname)
 	printf(_("  -e                 use European date input format (DMY)\n"));
 	printf(_("  -F                 turn fsync off\n"));
 	printf(_("  -h HOSTNAME        host name or IP address to listen on\n"));
-	printf(_("  -i                 enable TCP/IP connections\n"));
+	printf(_("  -i                 enable TCP/IP connections (deprecated)\n"));
 	printf(_("  -k DIRECTORY       Unix-domain socket location\n"));
 #ifdef USE_SSL
 	printf(_("  -l                 enable SSL connections\n"));
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index ad6693c358..75010d5a28 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -1039,9 +1039,11 @@ help(const char *progname)
 	printf(_("\nOptions controlling the output content:\n"));
 	printf(_("  -a, --data-only              dump only the data, not the schema\n"));
 	printf(_("  -b, --large-objects, --blobs\n"
-			 "                               include large objects in dump\n"));
+			 "                               include large objects in dump\n"
+			 "                               (--blobs is deprecated)\n"));
 	printf(_("  -B, --no-large-objects, --no-blobs\n"
-			 "                               exclude large objects in dump\n"));
+			 "                               exclude large objects in dump\n"
+			 "                               (--no-blobs is deprecated)\n"));
 	printf(_("  -c, --clean                  clean (drop) database objects before recreating\n"));
 	printf(_("  -C, --create                 include commands to create database in dump\n"));
 	printf(_("  -e, --extension=PATTERN      dump the specified extension(s) only\n"));
#2Heikki Linnakangas
hlinnaka@iki.fi
In reply to: Daniel Gustafsson (#1)
Re: Marking options deprecated in help output

On 05/12/2022 11:42, Daniel Gustafsson wrote:

In the pg_dump blob terminology thread it was briefly discussed [0] to mark
parameters as deprecated in the --help output. The attached is a quick diff to
show that that would look like. Personally I think it makes sense, not
everyone will read the docs.

Makes sense. One minor suggestion; instead of this:

-h, -H, --host=HOSTNAME database server host or socket directory
(-H is deprecated)

How about putting the deprecated option on a separate line like this:

-h, --host=HOSTNAME database server host or socket directory
-H (same as -h, deprecated)

And same for --blobs and -no-blobs

- Heikki

#3Daniel Gustafsson
daniel@yesql.se
In reply to: Heikki Linnakangas (#2)
1 attachment(s)
Re: Marking options deprecated in help output

On 24 Feb 2023, at 21:31, Heikki Linnakangas <hlinnaka@iki.fi> wrote:
On 05/12/2022 11:42, Daniel Gustafsson wrote:

How about putting the deprecated option on a separate line like this:

-h, --host=HOSTNAME database server host or socket directory
-H (same as -h, deprecated)

If nothing else, it helps to keep it shorter and avoids breaking the line
between command and description, so I agree with you. Done in the attached v2.

--
Daniel Gustafsson

Attachments:

deprecated_options_v2.diffapplication/octet-stream; name=deprecated_options_v2.diff; x-unix-mode=0644Download
diff --git a/contrib/oid2name/oid2name.c b/contrib/oid2name/oid2name.c
index 4edf02d9c7..e8c1e2c97b 100644
--- a/contrib/oid2name/oid2name.c
+++ b/contrib/oid2name/oid2name.c
@@ -217,7 +217,7 @@ help(const char *progname)
 		   "\nConnection options:\n"
 		   "  -d, --dbname=DBNAME        database to connect to\n"
 		   "  -h, --host=HOSTNAME        database server host or socket directory\n"
-		   "  -H                         same as -h, deprecated option\n"
+		   "  -H                         (same as -h, deprecated)\n"
 		   "  -p, --port=PORT            database server port number\n"
 		   "  -U, --username=USERNAME    connect as specified database user\n"
 		   "\nThe default action is to show all database OIDs.\n\n"
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index 96347eca1a..43978fd359 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -339,7 +339,7 @@ help(const char *progname)
 	printf(_("  -e                 use European date input format (DMY)\n"));
 	printf(_("  -F                 turn fsync off\n"));
 	printf(_("  -h HOSTNAME        host name or IP address to listen on\n"));
-	printf(_("  -i                 enable TCP/IP connections\n"));
+	printf(_("  -i                 enable TCP/IP connections (deprecated)\n"));
 	printf(_("  -k DIRECTORY       Unix-domain socket location\n"));
 #ifdef USE_SSL
 	printf(_("  -l                 enable SSL connections\n"));
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 24ba936332..1b06e3de4a 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -1037,10 +1037,10 @@ help(const char *progname)
 
 	printf(_("\nOptions controlling the output content:\n"));
 	printf(_("  -a, --data-only              dump only the data, not the schema\n"));
-	printf(_("  -b, --large-objects, --blobs\n"
-			 "                               include large objects in dump\n"));
-	printf(_("  -B, --no-large-objects, --no-blobs\n"
-			 "                               exclude large objects in dump\n"));
+	printf(_("  -b, --large-objects          include large objects in dump\n"
+			 "  --blobs                      (same as --large-objects, deprecated)\n"));
+	printf(_("  -B, --no-large-objects       exclude large objects in dump\n"
+			 "  --no-blobs                   (same as --no-large-objects, deprecated)\n"));
 	printf(_("  -c, --clean                  clean (drop) database objects before recreating\n"));
 	printf(_("  -C, --create                 include commands to create database in dump\n"));
 	printf(_("  -e, --extension=PATTERN      dump the specified extension(s) only\n"));