Piping data in from string or file (.piped)

bin_directory/command1:

#!/bin/bash
read X
echo hello $X > output
from commandlib import CommandPath
command_path = CommandPath("./bin_directory")

from string:

with open("person", "r") as handle:
    command_path.command1().piped.from_string("harry").run()

File ‘output’ will contain:

hello harry

from file handle:

with open("person", "r") as handle:
    command_path.command1().piped.from_handle(handle).run()

File ‘output’ will contain:

hello harry

from filename:

command_path.command1().piped.from_filename("person").run()

File ‘output’ will contain:

hello harry