29 lines
682 B
Python
29 lines
682 B
Python
import argparse
|
|
import os
|
|
from time import sleep
|
|
|
|
def main():
|
|
args = get_args()
|
|
with open(args.p, "r") as f:
|
|
f.seek(0, os.SEEK_END)
|
|
while True:
|
|
line = f.readline()
|
|
if not line:
|
|
sleep(0.1)
|
|
continue
|
|
if line[0] == "T":
|
|
for char in args.b:
|
|
print(char)
|
|
else:
|
|
print("")
|
|
|
|
|
|
def get_args():
|
|
ap = argparse.ArgumentParser()
|
|
ap.add_argument("-p", type=str, help="path to write out to", default="/tmp/cbappend.both.txt")
|
|
ap.add_argument("-b", type=str, help="keys to send while on", default="a")
|
|
return ap.parse_args()
|
|
|
|
if __name__ == "__main__":
|
|
main()
|