about summary refs log tree commit diff
path: root/xe.1
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2017-09-24 18:43:33 +0200
committerLeah Neukirchen <leah@vuxu.org>2017-09-24 18:43:33 +0200
commitc188e1313bb9808bab82e0a11b358bb1ec781049 (patch)
treea7927b11d89423bc6e5293feec66ba949bc67f8e /xe.1
parent53c7eebda4523eddbdc2b77e43a7cd5240b11352 (diff)
downloadxe-c188e1313bb9808bab82e0a11b358bb1ec781049.tar.gz
xe-c188e1313bb9808bab82e0a11b358bb1ec781049.tar.xz
xe-c188e1313bb9808bab82e0a11b358bb1ec781049.zip
add -p for percent rules
Diffstat (limited to 'xe.1')
-rw-r--r--xe.129
1 files changed, 28 insertions, 1 deletions
diff --git a/xe.1 b/xe.1
index fe7bc7b..b75209d 100644
--- a/xe.1
+++ b/xe.1
@@ -7,7 +7,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl 0FLRnv
-.Op Fl I Ar replace-arg
+.Oo Fl p | Fl I Ar replace-arg Oc
 .Op Fl N Ar maxargs
 .Op Fl j Ar maxjobs
 .Ar command\ ...
@@ -45,8 +45,12 @@ are read from the standard input.
 The resulting command is constructed from the command line parameters,
 replacing
 .Ar replace-arg
+(unless
+.Fl p
+is used, see below)
 with the read argument, and is executed with
 .Xr execvp 3 .
+.Pp
 In this mode, no shell is involved and
 .Ar replace-arg
 must appear as a word on its own, i.e.
@@ -122,6 +126,29 @@ Dry run: don't run the resulting commands, just print them.
 .It Fl v
 Verbose: print commands to standard error before running them.
 When used twice, also print job id and exit status for each command.
+.It Fl p
+Enable
+.Em percent rules :
+this mode disables the default
+.Ar replace-arg
+substition and enables
+.Xr make 1 Ns \&- Ns
+style percent rules.
+The first argument of
+.Ar command\ ...
+is regarded as a pattern:
+in the pattern, a single occurrence of
+.Li Sq \&%
+matches one or more characters,
+and replaces the first occurrence of
+.Li Sq \&%
+with the matched string in the remaining arguments,
+which are then used as the command to be executed.
+.Pp
+Multiple runs of patterns and commands are separated by
+.Li Sq \&+ .
+Only the first matching percent rule is executed;
+when no pattern matches, no command is run.
 .It Fl I Ar replace-arg
 Replace first occurrence of
 .Ar replace-arg