better explanations
This commit is contained in:
parent
49e8b76c2d
commit
5f18ecf6fc
2 changed files with 7 additions and 7 deletions
|
|
@ -8,7 +8,7 @@ A command line tool that call the given command for each input line matching the
|
|||
|
||||
`paternoster` [-h]
|
||||
|
||||
`paternoster` [-w] [-e] PATTERN COMMAND(S)
|
||||
`paternoster` [-w] [-e] [-g] PATTERN COMMAND(S)
|
||||
|
||||
|
||||
## DESCRIPTION
|
||||
|
|
@ -32,15 +32,21 @@ duplicated across remaining groups.
|
|||
|
||||
* `-w`, `--nowait`:
|
||||
Don't wait for the end of the current command before calling the next one.
|
||||
This will call commands as soon as they are met in the stream,
|
||||
If the stream is read fast, commands will most probably be ran quasi-simultaneously.
|
||||
|
||||
* `-e`, `--end`:
|
||||
Run commands at the end of the input stream.
|
||||
Note that if the stream don't end (for example if you input from `tail -f`),
|
||||
nothing will be done until an interruption.
|
||||
|
||||
* `-g`, `--group`:
|
||||
Capture groups as arguments for the CMD, instead of running CMD for each group.
|
||||
CMD must have as many formating placeholder as captured groups.
|
||||
For example, if you capture 3 groups, you must put 3 formating placeholders in CMD:
|
||||
`paternoster --group "^(.*):(.*):(.*)$" "echo '>>> 1:%s 2:%s 3:%s <<<'"`
|
||||
If placeholders count does not match the groups count, no substitution is made
|
||||
and the placeholders are left as is.
|
||||
|
||||
|
||||
## EXAMPLES
|
||||
|
|
|
|||
|
|
@ -93,11 +93,6 @@ def read_parse( stream_in, stream_out, pattern, cmd, nowait = False, at_end = Fa
|
|||
Read the given file-like object as a non-blocking stream
|
||||
and call the function on each item (line),
|
||||
with the given extra arguments.
|
||||
|
||||
A call to "map_write(sys.stdin, function, *args)" will translate to the
|
||||
non-blocking equivalent of:
|
||||
for item in sys.stdin.readlines():
|
||||
write( function( *args ) )
|
||||
"""
|
||||
|
||||
if at_end:
|
||||
|
|
@ -138,7 +133,6 @@ if __name__ == "__main__":
|
|||
help="A regular expression")
|
||||
|
||||
parser.add_argument("commands", metavar="CMD", type=str, nargs="+",
|
||||
default="espeak %s",
|
||||
help="The command to run if REGEX match. \
|
||||
If CMD contains a string formating placefolder (like \"%%s\"), \
|
||||
it will be replaced by the matching text. \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue