чување 43f937d2d0fd980e87ec4bb3ceeabf225687eaec
родитељ 46cddec2efa3b07b6c90efc640c3ceb217b8a526
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Mon, 13 May 2024 16:11:09 +0200
Add -V; tidy up manpages
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 8, додавања: 70(+), брисања: 52(-)
diff --git a/ste.1.in b/ste.1.in
@@ -6,7 +6,8 @@
.Nd Simple table editor
.Sh SYNOPSIS
.Nm
-.Op Fl hv
+.Op Fl hVv
+.Nm
.Op Ar tsvfile.tsv
.Sh DESCRIPTION
.Nm
@@ -17,23 +18,24 @@ to display and a number of POSIX shell scripts, which use
.Xr vipe 1
from moreutils to edit files in TSV (Tab Separated Values) format.
.
-.Ss Command line options
-.Bl -tag -width ".Nm Fl h" -offset indent
-.
-.It Nm Fl h
+.Bl -tag -width "-h " -offset indent
+.It Fl h
Prints usage information.
-.
-.It Nm Fl v
+.It Fl V
+Prints full version information (like
+.Fl v Ns
+), followed by copyright notice and global options set in
+.Pa ste.in .
+.It Fl v
Prints version and commit date.
-.
.El
.
-.Ss Interactive commands
+.Sh INTERACTIVE COMMANDS
.Nm
accepts interactive commands in its command interface.
Accepted commands are:
.
-.Bl -tag -width "help | h" -offset indent
+.Bl -tag -width "help , h" -offset indent
.
.It Ic / Oo Ar colno Oc Ar text
Search for
@@ -45,8 +47,8 @@ is given, limit the search to column number
.Ar colno
(1\-based).
.Pp
-When the last row was reached without a match, the user will be prompted whether
-to continue the search from the first row.
+When the last row was reached without a match, the user will be prompted to
+continue the search from the first row.
.
.It Ic =
Show current row.
@@ -61,13 +63,13 @@ If
.Ar amount
is omitted, show current screen width.
.
-.It Ic delete | Ic x
+.It Ic delete , Ic x
Delete the current table row.
.
-.It Ic edit | Ic e
+.It Ic edit , Ic e
Edit the current table row.
.
-.It Ic exit | Ic q
+.It Ic exit , Ic q
Exit
.Nm .
.
@@ -82,14 +84,14 @@ If
.Ar num
is not present, set current row to header row.
.
-.It Ic help Oo Ar command Oc | Ic h Op Ar command
+.It Ic help Oo Ar command Oc , Ic h Op Ar command
Show help
.Po about a Ar command Pc .
If the argument
.Ar command
is omitted, briefly list all commands.
.
-.It Ic insert Oo - | + Oc | Ic i Oo - | + Oc
+.It Ic insert Oo - | + Oc , Ic i Oo - | + Oc
Add a row to the table before
.Pq Ar -
or after
@@ -134,7 +136,7 @@ If the argument
.Ar colno
was given in the last search, the search will reuse it.
.
-.It Ic print | Ic p
+.It Ic print , Ic p
Print (redraw) the table.
.
.It Ic rows Op Ar amount
@@ -161,5 +163,5 @@ If argument is omitted, show all current option states.
.Xr tsvmove 1 ,
.Xr vipe 1
.Sh AUTHORS
-.An "Strahinya Radich" Aq contact@strahinja.org ,
+.An Strahinya Radich Aq Mt contact@strahinja.org ,
2023\-2024
diff --git a/ste.in b/ste.in
@@ -125,23 +125,48 @@ setopts()
usage()
{
- printf "Usage: %s [-h] [-v] [tsvfile.tsv]\n" "${prog}"
+ cat <<EOU
+Usage: ${prog} [-hVv]
+ ${prog} [tsvfile.tsv]
+EOU
+}
+
+version()
+{
+ printf "%s %s, committed on %s\n" \
+ "${prog}" "${VERSION}" "${DATE}"
}
file=$1
prog=${0##*/}
OPTIND=1
-while getopts hv OPT >/dev/null 2>&1
+while getopts hVv OPT >/dev/null 2>&1
do
case $OPT in
h) usage
exit
;;
- v) printf "%s %s, committed on %s\n" \
- "${prog}" "${VERSION}" "${DATE}"
+ V) version
+ cat <<EOC
+ This program is licensed under the terms of GNU GPL v3 or (at your option)
+ any later version. Copyright (C) 2023-2024 Страхиња Радић.
+ See the file LICENSE for exact copyright and license details.
+
+Global options:
+ clear: ${clear}
+ cols: ${cols}
+ historyfile: ${historyfile}
+ rows: ${rows}
+ msdos: ${msdos}
+ noansi: ${noansi}
+EOC
exit
;;
+ v) version
+ exit
+ ;;
+
?) error "Unknown parameter '%s'" "$1"
usage >&2
exit 1
diff --git a/tsvdel.1.in b/tsvdel.1.in
@@ -11,17 +11,15 @@
.Sh DESCRIPTION
.
.Bl -tag -width ".Nm Ar rowno" -offset indent
-.
-.It Nm Ar tsvfile.tsv Ar rowno
+.It Ar tsvfile.tsv Ar rowno
select the line (row) to be deleted by its row number (1\-based)
.
-.It Nm Ar tsvfile.tsv Ar colno Ar text
+.It Ar tsvfile.tsv Ar colno Ar text
select the line (row) to be deleted by searching the column with index
.Ar colno
(1\-based) for
.Ar text .
-.
.El
.Sh AUTHORS
-.An "Strahinya Radich" Aq contact@strahinja.org ,
+.An Strahinya Radich Aq Mt contact@strahinja.org ,
2023\-2024
diff --git a/tsvedit.1.in b/tsvedit.1.in
@@ -12,17 +12,15 @@
Read lines from stdin and interpret them as columns of a line to replace the
line from a TSV file;
.Bl -tag -width ".Nm Ar rowno" -offset indent
-.
-.It Nm Ar tsvfile.tsv Ar rowno
+.It Ar tsvfile.tsv Ar rowno
select the line (row) to be replaced by its row number (1\-based)
.
-.It Nm Ar tsvfile.tsv Ar colno Ar text
+.It Ar tsvfile.tsv Ar colno Ar text
select the line (row) to be replaced by searching the column with index
.Ar colno
(1\-based) for
.Ar text .
-.
.El
.Sh AUTHORS
-.An "Strahinya Radich" Aq contact@strahinja.org ,
+.An Strahinya Radich Aq Mt contact@strahinja.org ,
2023\-2024
diff --git a/tsvfind.1.in b/tsvfind.1.in
@@ -23,7 +23,6 @@ is not found,
sets return status to 1.
.
.Bl -tag -width ".Nm Ar rowno" -offset indent
-.
.It Fl s Ar rowno
Start from row number
.Ar rowno
@@ -33,9 +32,8 @@ Start from row number
Text to search for
.
.It Ar colno
-Column number to limit the search to (1-based)
-.
+Column number to limit the search to (1\-based)
.El
.Sh AUTHORS
-.An "Strahinya Radich" Aq contact@strahinja.org ,
+.An Strahinya Radich Aq Mt contact@strahinja.org ,
2023\-2024
diff --git a/tsvins.1.in b/tsvins.1.in
@@ -12,7 +12,7 @@
Read lines from stdin and interpret them as columns of a line to insert to a TSV
file after the line
.Ar lineno
-(1-based).
+(1\-based).
When 0 is passed as
.Ar lineno ,
insert a line as first (header) line.
@@ -20,5 +20,5 @@ If
.Ar lineno
is omitted, insert a line at the end of file.
.Sh AUTHORS
-.An "Strahinya Radich" Aq contact@strahinja.org ,
+.An Strahinya Radich Aq Mt contact@strahinja.org ,
2023\-2024
diff --git a/tsvmove.1.in b/tsvmove.1.in
@@ -12,17 +12,15 @@
.Sh DESCRIPTION
.
.Bl -tag -width ".Nm Ar rowno" -offset indent
-.
-.It Nm Ar tsvfile.tsv Ar rowno Ar rowno
+.It Ar tsvfile.tsv Ar rowno Ar rowno
select the line (row) to be moved by its row number (1\-based)
.
-.It Nm Ar tsvfile.tsv Ar colno Ar text Ar rowno
+.It Ar tsvfile.tsv Ar colno Ar text Ar rowno
select the line (row) to be moved by searching the column with index
.Ar colno
(1\-based) for
.Ar text .
-.
.El
.Sh AUTHORS
-.An "Strahinya Radich" Aq contact@strahinja.org ,
+.An Strahinya Radich Aq Mt contact@strahinja.org ,
2023\-2024
diff --git a/tsvselect.1.in b/tsvselect.1.in
@@ -12,31 +12,30 @@
Output a line (row) from a TSV file, with each column being output on a separate
line, and preceded by a line containing a hashmark (
.Li #
-) followed by space and
+) followed by space and
.Dq column title ;
.Bl -tag -width ".Nm Ar rowno" -offset indent
-.
-.It Nm Ar tsvfile.tsv Ar rowno
+.It Ar tsvfile.tsv Ar rowno
select the line (row) to be output by its row number (1\-based)
.
-.It Nm Ar tsvfile.tsv Ar colno Ar text
+.It Ar tsvfile.tsv Ar colno Ar text
select the line (row) to be output by searching the column with index
.Ar colno
(1\-based) for
.Ar text .
-.
.El
.
For example, for the TSV file
.Pa students.tsv :
-.Bd -literal
+.Bd -literal -offset indent
ID Name Age
1 John 25
2 Peter 33
.Ed
+.Pp
.Ql tsvselect students.tsv 3
will output:
-.Bd -literal
+.Bd -literal -offset indent
# ID
2
# Name
@@ -46,5 +45,5 @@ Peter
.Ed
.
.Sh AUTHORS
-.An "Strahinya Radich" Aq contact@strahinja.org ,
+.An Strahinya Radich Aq Mt contact@strahinja.org ,
2023\-2024