コード例 #1
0
	void Complete( const CmdArgs &args, argCompletionCB_t callback ) const {
		int num, i;
		StringList fullList;
		const DictEx<ConsoleCmd> &cmdList = CmdSystemObject.GetCommandList();
		num = cmdList.Num();
		for( i = 0; i < num; i++ )
			fullList.Append( cmdList.GetKey(i) );
		const DictEx<CVarDataEx> &cvarDataList = cvarSystemEx->GetCVarDataList();
		num = cvarDataList.Num();
		for( i = 0; i < num; i++ )
			fullList.Append( cvarDataList.GetKey(i) );

		fullList.Sort( StringListICmp, true );
		num = fullList.Num();
		Format complete( "$* $*" );
		for( i = 0; i < num; i++ ) {
			callback( complete << args.Argv( 0 ) << fullList[i] );
			complete.Reset();
		}
	}
コード例 #2
0
void CmdSystemEx::Cmd_Help_f( const CmdArgs &args ) {
	if ( args.Argc() > 2 ) {
		Cmd_Help_Usage.ShowUsage();
		return;
	}

	const char *cmd = args.Argv(1);
	// Try Command List
	int i = CmdSystemObject.cmdList.Find(cmd);
	if ( i != -1 ) {
		Console::Print( Format( "$*: $*\n" ) << CmdSystemObject.cmdList.GetKey(i) << CmdSystemObject.cmdList[i].usage->strDescription );
		CmdSystemObject.cmdList[i].usage->ShowUsage();
		return;
	}
	// Not a Command, is it a CVar?
	CVar *cv = cvarSystem->Find(cmd);
	if ( cv ) {
		Console::Print( Format( "$*: $*\n" ) << cv->data->strName << cv->data->strDescription );
		return;
	}
	Console::Print( Format( "Command/Cvar not found: '$*'.\n" ) << cmd );
}
コード例 #3
0
void CmdSystemEx::Cmd_Exec_f( const CmdArgs &args ) {
	String name = args.Argv(1);
	name.DefaultFileExtension(".cfg");
	Console::Print( Format( "Executing '$*'\n" ) << name );
	cmdSystem->ExecuteConfig( name.c_str() );
}