mirror of
https://github.com/codingo/Interlace.git
synced 2025-12-18 23:34:19 +01:00
Added replacement code
This commit is contained in:
@@ -47,13 +47,16 @@ class InputHelper(object):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def process_commands(arguments):
|
def process_commands(arguments):
|
||||||
commands = set()
|
commands = set()
|
||||||
|
targets = arguments.process_targets(arguments)
|
||||||
|
|
||||||
if arguments.command:
|
for target in targets:
|
||||||
commands.add(arguments.command)
|
# replace flags
|
||||||
else:
|
for command in commands:
|
||||||
for command in arguments.command_list:
|
command = command.replace("$target", target)
|
||||||
commands.add(command.strip())
|
command = command.replace("$output", arguments.output)
|
||||||
|
command = command.replace("$port", arguments.port)
|
||||||
|
command = command.replace("$realport", arguments.realport)
|
||||||
|
commands.add(command)
|
||||||
return commands
|
return commands
|
||||||
|
|
||||||
|
|
||||||
@@ -110,6 +113,24 @@ class InputParser(object):
|
|||||||
type=lambda x: InputHelper.readable_file(parser, x)
|
type=lambda x: InputHelper.readable_file(parser, x)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
commands = parser.add_mutually_exclusive_group(required=True)
|
||||||
|
commands.add_argument(
|
||||||
|
'-o', dest='output',
|
||||||
|
help='Specify an output folder variable that can be used in commands as $output'
|
||||||
|
)
|
||||||
|
|
||||||
|
commands = parser.add_mutually_exclusive_group(required=True)
|
||||||
|
commands.add_argument(
|
||||||
|
'-p', dest='port',
|
||||||
|
help='Specify a port variable that can be used in commands as $port'
|
||||||
|
)
|
||||||
|
|
||||||
|
commands = parser.add_mutually_exclusive_group(required=True)
|
||||||
|
commands.add_argument(
|
||||||
|
'-rp', dest='realport',
|
||||||
|
help='Specify a real port variable that can be used in commands as $realport'
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--no-cidr', dest='nocidr', action='store_true', default=False,
|
'--no-cidr', dest='nocidr', action='store_true', default=False,
|
||||||
help='If set then CIDR notation in a target file will not be automatically '
|
help='If set then CIDR notation in a target file will not be automatically '
|
||||||
|
|||||||
Reference in New Issue
Block a user