cli_execute_output

From Kolmafia
Revision as of 14:52, 23 December 2020 by Philmasterplus (talk | contribs) (Created page with "<onlyinclude>{{{{{format|Function2}}} |name=cli_execute_output |function1.return_type=string |function1.description=Executes a gCLI command, capturing and returning the gCLI o...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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()