Support for both str and function read_commands