<commit_before>public class Args {

private OptionContext context;
private OptionGroup config_group;
private string utext;
public bool debug;
public bool show_missing;

public
Args()
{
	debug = false;

	utext = """[TEMPLATES...]

	Copyright (c) 2012 The AUTHORS. See the AUTHORS file.
	See the COPYING file for license(s)/distribution details.""";

	config_group = new OptionGroup("config", "Configuration Options:",
	    "Show configuration options");
	
	create_entries();

	context = new OptionContext(utext);
	context.add_group((owned)config_group);
}

public void
create_entries()
{
	config_group.add_entries({
		OptionEntry() {
			long_name = "config", short_name = 'c',
			arg_data = &(chk.cfg), arg = OptionArg.FILENAME,
			description = "Override detected xbps-src config file",
			arg_description = "FILENAME"
		}, OptionEntry() {
			long_name = "distdir", short_name = 'd',
			arg_data = &(chk.distdir), arg = OptionArg.FILENAME,
			description = "Override xbps-src DISTDIR setting",
			arg_description = "DIRECTORY"
		}, OptionEntry() {
			long_name = "show-missing", short_name = 's',
			arg_data = &show_missing,
			description = "Show missing binpkgs for templates"
		}, OptionEntry()

	});
}

public void
parse(string[] argv)
{
	try {
		context.parse(ref argv);
	} catch (OptionError error) {
		stderr.printf("%s error: %s", "xbps-repo-checkvers",
			error.message);
		usage();
	}
	if (argv.length > 1) {
		chk.templates = new string[argv.length-1];
		for (int i = 1; i < argv.length; i++) {
			chk.templates[i-1] = argv[i];
		}
		return;
	}
}

public void
usage()
{
	stdout.printf("%s", context.get_help(false, null));
	Process.exit(1);
}


} /* class Args */<commit_msg>args.vala: show OptionError correctly.<commit_after>public class Args {

private OptionContext context;
private OptionGroup config_group;
private string utext;
public bool debug;
public bool show_missing;

public
Args()
{
	debug = false;

	utext = """[TEMPLATES...]

	Copyright (c) 2012 The AUTHORS. See the AUTHORS file.
	See the COPYING file for license(s)/distribution details.""";

	config_group = new OptionGroup("config", "Configuration Options:",
	    "Show configuration options");
	
	create_entries();

	context = new OptionContext(utext);
	context.add_group((owned)config_group);
}

public void
create_entries()
{
	config_group.add_entries({
		OptionEntry() {
			long_name = "config", short_name = 'c',
			arg_data = &(chk.cfg), arg = OptionArg.FILENAME,
			description = "Override detected xbps-src config file",
			arg_description = "FILENAME"
		}, OptionEntry() {
			long_name = "distdir", short_name = 'd',
			arg_data = &(chk.distdir), arg = OptionArg.FILENAME,
			description = "Override xbps-src DISTDIR setting",
			arg_description = "DIRECTORY"
		}, OptionEntry() {
			long_name = "show-missing", short_name = 's',
			arg_data = &show_missing,
			description = "Show missing binpkgs for templates"
		}, OptionEntry()

	});
}

public void
parse(string[] argv)
{
	try {
		context.parse(ref argv);
	} catch (OptionError error) {
		stderr.printf("%s error: %s\n", argv[0], error.message);
		usage();
	}
	if (argv.length > 1) {
		chk.templates = new string[argv.length-1];
		for (int i = 1; i < argv.length; i++) {
			chk.templates[i-1] = argv[i];
		}
		return;
	}
}

public void
usage()
{
	stdout.printf("%s", context.get_help(false, null));
	Process.exit(1);
}


} /* class Args */
{'fraction_non_alphanumeric': 0.14657210401891252, 'fraction_numerical': 0.0056146572104018916, 'mean_word_length': 4.175840978593272, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7294786', 'n_tokens_mistral': 1242, 'n_tokens_neox': 1137, 'n_words': 293}