<commit_before>import './Output'
import './MakeCommandCommand'

import program from 'commander'

export class Cli {
	app = null
	commands = [ ]
	output = null

	constructor(app) {
		this.app = app
		this.output = new Output
		this.register(MakeCommandCommand)
	}

	run(args = process.argv) {
		this.app.boot()

		const info = require(this.app.paths.package)
		const cli = program

		if(!info.version.isNil) {
			cli.version(info.version)
		}

		this.commands.sort((a, b) => (a.name || '').localeCompare(b.name || ''))

		for(const command of this.commands) {
			command.build(cli)
		}

		if(args.length === 2) {
			args.push('--help')
		}

		cli.on('*', args => {
			this.output.error('Command ”%s” not found.', args.shift())
			process.exit(1)
		})<commit_msg>Cli.run is now async (to support new async app.boot())<commit_after>import './Output'
import './MakeCommandCommand'

import program from 'commander'

export class Cli {
	app = null
	commands = [ ]
	output = null

	constructor(app) {
		this.app = app
		this.output = new Output
		this.register(MakeCommandCommand)
	}

	async run(args = process.argv) {
		await this.app.boot()

		const info = require(this.app.paths.package)
		const cli = program

		if(!info.version.isNil) {
			cli.version(info.version)
		}

		this.commands.sort((a, b) => (a.name || '').localeCompare(b.name || ''))

		for(const command of this.commands) {
			command.build(cli)
		}

		if(args.length === 2) {
			args.push('--help')
		}

		cli.on('*', args => {
			this.output.error('Command ”%s” not found.', args.shift())
			process.exit(1)
		})
{'fraction_non_alphanumeric': 0.17142857142857143, 'fraction_numerical': 0.0025396825396825397, 'mean_word_length': 3.317808219178082, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5489133', 'n_tokens_mistral': 624, 'n_tokens_neox': 553, 'n_words': 118}