<commit_before>import 'package:dotdotcommadot_commands/dotdotcommadot_commands.dart';
import 'commands/login_command.dart';
import 'hooks/print_hello_world_hook.dart';
import 'guards/check_one_and_one_is_two_guard.dart';
import 'guards/check_one_and_one_is_three_guard.dart';

void main()
{
	// 1. Basic Example
	runBasicExample();

	// 2. Example with Hook and Guard
	runExampleWithHookAndGuard();

	// 3. Example with Hook and Blocking Guard
	runExampleWithHookAndBlockingGuard();
}

void runBasicExample()
{
	CommandRunner runner = new CommandRunner();

	runner.add(new LoginCommand());

	runner.run()
		.then((List<CommandResult> results) => results.where((R) => !R.isSucceeded).forEach((R) => print(R.message)));
}

void runExampleWithHookAndGuard()
{
	CommandRunner runner = new CommandRunner();

	runner.addAll([
		new LoginCommand()
			.withHooks([new PrintHelloWorldHook()])
			.withGuards([new CheckOneAndOneIsTwoGuard()]),

		new LoginCommand()
			.withHooks([new PrintHelloWorldHook()])
			.withGuards([new CheckOneAndOneIsTwoGuard()])
	]);

	runner.run()
		.then((List<CommandResult> results) => results.where((R) => !R.isSucceeded).forEach((R) => print(R.message)));
}

void runExampleWithHookAndBlockingGuard()
{
	CommandRunner runner = new CommandRunner();

	runner.addAll([
		// non blocking
		new LoginCommand()
			.withHooks([new PrintHelloWorldHook()])
			.withGuards([new CheckOneAndOneIsTwoGuard()]),

		// blocking
		new LoginCommand()
			.withHooks([new PrintHelloWorldHook()])
			.withGuards([new CheckOneAndOneIsThreeGuard()]),

		// non blocking
		new LoginCommand()
			.withHooks([new PrintHelloWorldHook()])
			.withGuards([new CheckOneAndOneIsTwoGuard()])
	]);

	runner.run()
		.then((List<CommandResult> results) => results.where((R) => !R.isSucceeded).forEach((R) => print(R.message)));
}<commit_msg>Adds Example With For Loop<commit_after>import 'package:dotdotcommadot_commands/dotdotcommadot_commands.dart';
import 'commands/login_command.dart';
import 'hooks/print_hello_world_hook.dart';
import 'guards/check_one_and_one_is_two_guard.dart';
import 'guards/check_one_and_one_is_three_guard.dart';

void main()
{
	// 1. Basic Example
	runBasicExample();

	// 2. Example with Hook and Guard
	runExampleWithHookAndGuard();

	// 3. Example with Hook and Blocking Guard
	runExampleWithHookAndBlockingGuard();

	// 4. Example with For loop
	runExampleWithForLoop();
}

void runBasicExample()
{
	CommandRunner runner = new CommandRunner();

	runner.add(new LoginCommand());

	runner.run()
		.then((List<CommandResult> results) => results.where((R) => !R.isSucceeded).forEach((R) => print(R.message)));
}

void runExampleWithHookAndGuard()
{
	CommandRunner runner = new CommandRunner();

	runner.addAll([
		new LoginCommand()
			.withHooks([new PrintHelloWorldHook()])
			.withGuards([new CheckOneAndOneIsTwoGuard()]),

		new LoginCommand()
			.withHooks([new PrintHelloWorldHook()])
			.withGuards([new CheckOneAndOneIsTwoGuard()])
	]);

	runner.run()
		.then((List<CommandResult> results) => results.where((R) => !R.isSucceeded).forEach((R) => print(R.message)));
}

void runExampleWithHookAndBlockingGuard()
{
	CommandRunner runner = new CommandRunner();

	runner.addAll([
		// non blocking
		new LoginCommand()
			.withHooks([new PrintHelloWorldHook()])
			.withGuards([new CheckOneAndOneIsTwoGuard()]),

		// blocking
		new LoginCommand()
			.withHooks([new PrintHelloWorldHook()])
			.withGuards([new CheckOneAndOneIsThreeGuard()]),

		// non blocking
		new LoginCommand()
			.withHooks([new PrintHelloWorldHook()])
			.withGuards([new CheckOneAndOneIsTwoGuard()])
	]);

	runner.run()
		.then((List<CommandResult> results) => results.where((R) => !R.isSucceeded).forEach((R) => print(R.message)));
}

void runExampleWithForLoop()
{
	CommandRunner runner = new CommandRunner();

	for (int i = 0; i < 3; i++)
	{
		runner.add(
			new LoginCommand()
			.withHooks([new PrintHelloWorldHook()])
			.withGuards([new CheckOneAndOneIsTwoGuard()])
		);
	}

	runner.run()
		.then((List<CommandResult> results) => results.where((R) => !R.isSucceeded).forEach((R) => print(R.message)));
}
{'fraction_non_alphanumeric': 0.15380871258213677, 'fraction_numerical': 0.0021903139449987834, 'mean_word_length': 5.492890995260663, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6700994', 'n_tokens_mistral': 1479, 'n_tokens_neox': 1362, 'n_words': 248}