Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dongyx committed May 29, 2022
1 parent 01a8d57 commit e7bb204
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ Building *shsub* requires:
USAGE
-----

`shsub` \[*options*\] \[*file*\]
`shsub` \[*options*\] \[*file*\] \[*argument* ...\]

If *file* is omitted, `shsub` reads the template from stdin.
If *file* is `-` or omitted, `shsub` reads the template from stdin.

options:

Expand Down
18 changes: 10 additions & 8 deletions cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ tc="$dir/tc"

help() {
cat <<\.
usage: shsub [<options>] [<file>]
if <file> is omitted, read from stdin.
options:
-s <sh> specify the shell to execute the compiled script,
`/bin/sh' by default
-h print the brief usage
-v print the version information
usage: shsub [<options>] [<file>] [<argument> ...]
if <file> is `-' or omitted, read from stdin.
options
-s <sh> specify the shell to execute the compiled script,
`/bin/sh' by default
-h print the brief usage
-v print the version information
.
}
Expand Down
8 changes: 0 additions & 8 deletions shsub.1
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,32 @@ and execute it

\fBshsub\fR [\fIoptions\fR] [\fIfile\fR\] [\fIargument\fR ...]

.PP
\fBshsub\fR reads the shell template from \fIfile\fR.
If \fIfile\fR is \fB-\fR or omitted, \fBshsub\fR reads from stdin.

.SH DESCRIPTION

.PP
A shell template is text
with shell commands and expressions embedded in.

.PP
The shell commands are surrounded by \fB<%\fR and \fB%>\fR.
Each \fB<%\fIcmd\fB%>\fR is compiled to \fIcmd\fR.

.PP
The shell expressions are surrounded by \fB<%=\fR and \fB%>\fR.
Each \fB<%=\fIexpr\fB%>\fR is compiled to
\fBprintf %s \[dq]\fIexpr\fB\[dq]\fR.
Leading and trailing spaces, tabs, and newlines of \fIexpr\fR
are removed.
Double quotes in \fIexpr\fR are automatically escaped.

.PP
Ordinary text is compiled to the command printing that text.

.PP
\fB<%%\fR and \fB%%>\fR are escaping tokens representing
literal \fB<%\fR and \fB%>\fR.

.PP
If \fB-%>\fR is used instead of \fB%>\fR,
\fBshsub\fR ignores the following newline.

.PP
If the first line of the shell template begins with
\fB#!\fR (\fIshebang\fR), it will be ignored.
This is for the convenience of making executable shell templates.
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.0
1.4.1

0 comments on commit e7bb204

Please sign in to comment.