gbranden pushed a commit to branch master
in repository groff.

commit 4a502cd024b0c3f07ecd99a1954247deba4a3773
Author: G. Branden Robinson <[email protected]>
AuthorDate: Sat Dec 23 14:05:50 2023 -0600

    [gdiffmk]: Tweak output in error scenarios.
    
    * contrib/gdiffmk/gdiffmk.sh: Tweak output in error scenarios.  Add
      `want_help` variable to track whether `--help` option was specified.
    
      (Usage): Stop writing a blank line after a usage error; omitting it is
      more consistent with other groff programs.  Omit the descriptive
      paragraph unless help is requested.
---
 contrib/gdiffmk/ChangeLog  | 8 ++++++++
 contrib/gdiffmk/gdiffmk.sh | 8 +++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/contrib/gdiffmk/ChangeLog b/contrib/gdiffmk/ChangeLog
index d99f4d7a3..c9c14d005 100644
--- a/contrib/gdiffmk/ChangeLog
+++ b/contrib/gdiffmk/ChangeLog
@@ -1,3 +1,11 @@
+2023-12-23  G. Branden Robinson <[email protected]>
+
+       * gdiffmk.sh: Tweak output in error scenarios.  Add `want_help`
+       variable to track whether `--help` option was specified.
+       (Usage): Stop writing a blank line after a usage error; omitting
+       it is more consistent with other groff programs.  Omit the
+       descriptive paragraph unless help is requested.
+
 2023-12-23  G. Branden Robinson <[email protected]>
 
        * gdiffmk.sh (Usage): Abbreviate usage message to just a
diff --git a/contrib/gdiffmk/gdiffmk.sh b/contrib/gdiffmk/gdiffmk.sh
index 8d8fc27ab..41ca120df 100644
--- a/contrib/gdiffmk/gdiffmk.sh
+++ b/contrib/gdiffmk/gdiffmk.sh
@@ -32,7 +32,6 @@ Usage () {
        then
                Diagnose "usage error: $@"
                exec 2>&1
-               echo
                status=2
        fi
        cat >&2 <<EOF
@@ -41,12 +40,17 @@ usage: ${CMD} [-a add-mark] [-c change-mark] [-d 
delete-mark] \
 [output-file]
 usage: ${CMD} --version
 usage: ${CMD} --help
+EOF
+       if [ -n "$want_help" ]
+       then
+               cat >&2 <<EOF
 
 Compare roff(7) documents file1 and file2, and write a roff document
 to the standard output stream (or output-file) consisting of file2 with
 added margin character ('mc') requests indicating output lines that
 differ from file1.  See the gdiffmk(1) manual page.
 EOF
+       fi
        exit $status
 }
 
@@ -162,6 +166,7 @@ DIFFCMD=@DIFF_PROG@
 SEDCMD=sed
 D_option=
 br=.br
+want_help=
 while [ $# -gt 0 ]
 do
        OPTION="$1"
@@ -207,6 +212,7 @@ do
                exit 0
                ;;
        --help)
+               want_help=yes
                Usage
                ;;
        --)

_______________________________________________
Groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to