<commit_before>function SortUtil() {
	SortUtil.super_.call(this, [
		['n', 'numeric', 'numeric sort'],
		['r', 'reverse', 'reverse (descending order)'],
		['m', 'merge', 'merge already sorted files'],
		['s', 'stable', 'stable sort'],
		['u', 'unique', 'unique'],
		['T', 'tmp-dir=DIR', 'use DIR for temporaries'],
		['S', 'buffer-size=SIZE', 'use SIZE for main memory buffer (bytes)'],
		['k', 'key=KEYDEF', 'sort key definition']
	], '-k KEYDEF');
};

require('util').inherits(SortUtil, require('../Util.js').Util);

SortUtil.prototype.run = function() {
	var jp = this.jp;
	var separator = '\t';

	var sortOptions = {
		numeric: this.getOption('numeric'),
		reverse: this.getOption('reverse'),
		merge: this.getOption('merge'),
		stable: this.getOption('stable'),
		unique: this.getOption('unique'),
		tmpDir: this.getOption('tmp-dir'),
		bufferSize: this.getOption('buffer-size')
	};

	var keyGenerator = this.needOptionFunction('key');
	var keyStringGenerator;

	if(sortOptions.numeric) {
		keyStringGenerator = function(obj) {
			var key = keyGenerator(obj);

			return ('' + key).match(/^[0-9]*/)[0];
		};<commit_msg>Ключ сортировки перенесён из опции -k в обязательный аргумент<commit_after>function SortUtil() {
	SortUtil.super_.call(this, [
		['n', 'numeric', 'numeric sort'],
		['r', 'reverse', 'reverse (descending order)'],
		['m', 'merge', 'merge already sorted files'],
		['s', 'stable', 'stable sort'],
		['u', 'unique', 'unique'],
		['T', 'tmp-dir=DIR', 'use DIR for temporaries'],
		['S', 'buffer-size=SIZE', 'use SIZE for main memory buffer (bytes)'],
	], 'KEYDEF');
};

require('util').inherits(SortUtil, require('../Util.js').Util);

SortUtil.prototype.run = function() {
	var jp = this.jp;
	var separator = '\t';

	var sortOptions = {
		numeric: this.getOption('numeric'),
		reverse: this.getOption('reverse'),
		merge: this.getOption('merge'),
		stable: this.getOption('stable'),
		unique: this.getOption('unique'),
		tmpDir: this.getOption('tmp-dir'),
		bufferSize: this.getOption('buffer-size')
	};

	var keyGenerator = this.needArgumentFunction(0);
	this.shiftArguments();

	var keyStringGenerator;

	if(sortOptions.numeric) {
		keyStringGenerator = function(obj) {
			var key = keyGenerator(obj);

			return ('' + key).match(/^[0-9]*/)[0];
		};
{'fraction_non_alphanumeric': 0.20915896081021576, 'fraction_numerical': 0.0030823425803610744, 'mean_word_length': 4.932114882506528, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5275677', 'n_tokens_mistral': 828, 'n_tokens_neox': 773, 'n_words': 175}