mirror of
https://github.com/rwinkhart/sshyp.git
synced 2026-09-06 09:07:13 -04:00
port-jobs: Added comment/PORT comment removal script
Former-commit-id: 7dd83192d82c4c3a059b50fd6fd51f8a42d381ec Former-commit-id: c789f40d10eee7efec8818cdae89e8edb252d7a1
This commit is contained in:
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python3
|
||||
import re
|
||||
from sys import argv
|
||||
|
||||
# read arguments
|
||||
arguments = argv[1:]
|
||||
|
||||
# define regular expression depending on arguments
|
||||
if 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)
|
||||
Reference in New Issue
Block a user