Add --version:copy, deprecate --version:paste.

This commit is contained in:
nhkeni
2023-08-03 21:51:25 -04:00
parent 9d9042e94b
commit 1663ecf85d
3 changed files with 12 additions and 8 deletions

View File

@@ -111,11 +111,11 @@ nethack --directory:Dir -s
as above; alternate directory, if specified, should come first.
nethack --version
nethack --version:paste
nethack --version:copy
'--version' display the program's version number and exit;
'--version:paste' display version number and also copy it into system
'--version:copy' display version number and also copy it into system
pasteboard (should work on macOS and Windows; might not work on other
systems) so that it could be copied from there into a subsequent email
systems) so that it could be pasted from there into a subsequent email
or web contact form, then exit.
nethack --showpaths

View File

@@ -9,7 +9,7 @@
.ds Nr \\$2
..
.NB $NHDT-Branch: NetHack-3.7 $
.NR $NHDT-Revision: 1.27 $
.NR $NHDT-Revision: 1.31 $
.ds Na Robert Patrick Rankin
.SH NAME
nethack \- Exploring The Mazes of Menace
@@ -124,7 +124,7 @@ Also
.BR \-\-showpaths
]
[
.BR \-\-version [ :paste ]
.BR \-\-version [ :copy ]
]
.ad
.hy 14
@@ -374,7 +374,7 @@ That will include the
.I git
commit hash if the information was available when the game was compiled.
On some platforms, such as Windows and macOS, a variation
.B \-\-version:paste
.B \-\-version:copy
can be used to cause NetHack to show the version information, then exit,
while also leaving a copy of the version information in the paste buffer
or clipboard for potential insertion into things like bug reports.

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 allmain.c $NHDT-Date: 1688415115 2023/07/03 20:11:55 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.219 $ */
/* NetHack 3.7 allmain.c $NHDT-Date: 1691113621 2023/08/04 01:47:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.220 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -966,11 +966,15 @@ argcheck(int argc, char *argv[], enum earlyarg e_arg)
if (extended_opt) {
extended_opt++;
/* Deprecated in favor of "copy" - remove no later
than next major version */
if (match_optname(extended_opt, "paste", 5, FALSE)) {
insert_into_pastebuf = TRUE;
} else if(match_optname(extended_opt, "copy", 4, FALSE)) {
insert_into_pastebuf = TRUE;
} else {
raw_printf(
"-%sversion can only be extended with -%sversion:paste.\n",
"-%sversion can only be extended with -%sversion:copy.\n",
dashdash, dashdash);
return TRUE;
}