Open jdhedden opened 2 years ago
The run function currently only works a single word, so trying to use command line argument with a command doesn't work (e.g., 'chmod 755'). The version adds that capability:
run
@register("run") @typed(T_ARRAY, T_VOID) def run(command, inp): command = dynamic_cast(T_STRING, command).value.split() args = map(T_STRING.create_from, inp) args = list(map(lambda v: v.value, args)) print("Running '{}' with arguments {}".format(command, args)) subprocess.call(command + args)
For README.md:
### Usage of `run` The `run` *function* executes a command over arguments presented:
/usr/bin/ls -1 ft/ft/*.py | map run 'chmod 644' Running '['chmod', '644']' with arguments ['ft/ft/command.py'] Running '['chmod', '644']' with arguments ['ft/ft/error.py'] Running '['chmod', '644']' with arguments ['ft/ft/functions.py'] Running '['chmod', '644']' with arguments ['ft/ft/init.py'] Running '['chmod', '644']' with arguments ['ft/ft/internal.py'] Running '['chmod', '644']' with arguments ['ft/ft/termcolor.py'] Running '['chmod', '644']' with arguments ['ft/ft/test_command.py'] Running '['chmod', '644']' with arguments ['ft/ft/types.py'] Running '['chmod', '644']' with arguments ['ft/ft/version.py']
Thanks. Please see the other tickets regarding the maintenance status of this project.
The
run
function currently only works a single word, so trying to use command line argument with a command doesn't work (e.g., 'chmod 755'). The version adds that capability:For README.md: