Files
sshyp/port-jobs/COMMENTS.py
T
RandyTheSilly 92f26c47af port-jobs: Added default behavior for port-jobs if no argument is supplied
Former-commit-id: 0af03c8af7101fead7de41f2f644ea80c38a5392
Former-commit-id: 1f9607f85ca9d1cf786741a34124eda589f3dd95
2023-04-14 12:50:49 -04:00

22 lines
519 B
Python
Executable File

#!/usr/bin/env python3
import re
from sys import argv
# read arguments
arguments = argv[1:]
# define regular expression depending on arguments
if len(arguments) > 0 and arguments[0] == 'ALL':
regex = re.compile(r'^\s*#.*$\n?', re.MULTILINE)
else:
regex = re.compile(r'^\s*# PORT.*$\n?', re.MULTILINE)
# read input file
text = open("working/sshyp.py", "r").read()
# run the defined regular expression
new_text = re.sub(regex, '', text)
# write the updated text
open("working/sshyp.py", "w").write(new_text)