-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
47 lines (37 loc) · 2.18 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
usage: term_proxy.py [-h] [-H PATTERN_FILES] [--help-patterns] [-e] [-l]
[-p PROMPT] [-c ...]
Run a forign terminal program with the ability to automate some interaction
optional arguments:
-h, --help show this help message and exit
-H PATTERN_FILES, --pattern-file PATTERN_FILES
A file specifying regex patterns for call/response
functionality
--help-patterns Show info on patterns files
-e, --include-err Also apply pattern actions to stderr output
-l, --unlined-output Don't assume the forign program always outputs full
lines all at once
-p PROMPT, --prompt PROMPT
Change prompt character(s)
-c ... The command to execute
==============================================================================
Information on Patterns Files:
Patterns files allow some automation based on the output of the forign
program. The first line of the pattern file should specify a seperator for the
subsequent lines, by using it to seperate the words 'pattern', 'action', and
'translation'. Example, using ' ===== ' as the seperator:
pattern ===== action ===== translation
The file follows these headers; the first element on each line should be a
regular expression pattern, followed by an action, followed by a formatting
string. If a line outputted by the forign program matches the pattern, the
action will be applied. The following actions are supported:
respond: the formatted string will be sent to the forign programs stdin
replace: the formatted string will be printed instead of the original line
print: the formatted string will be printed along with the original line
filter: nothing will be printed
function: the function named by the formatted string from the
user_functions file will be called.
The formatting strings will be formatted with numbers in braces replaced by
the group from the expression. Example, using the above seperator:
login: (w+) ===== replace ===== The user {1} has logged in.
Whenever the forign program prints a login message the more verbose version
will be printed to the screen.