cli_execute_output

From Kolmafia
Jump to navigation Jump to search

Function Syntax

string cli_execute_outputstring command )

Executes a gCLI command, capturing and returning the gCLI output.
  • command: gCLI command to execute

This function behaves like cli_execute(), except that it captures the text printed to the gCLI and returns it as a string. This can be used to manually parse the gCLI output.

This does not suppress the gCLI output. Rather, it

The returned string contains the raw HTML output.

Code Samples

Capture the output of the ashref command and save it to a file.

buffer b;
b.append( cli_execute_output( "ashref" );
if ( !buffer_to_file( b, "ashref.txt" ) )
{
   abort( "Failed to save ashref.txt" );
}

See Also

cli_execute() | cli_execute_output()