<commit_before>//
//  main.swift
//  Carthage
//
//  Created by <NAME> on 2014-10-10.
//  Copyright (c) 2014 Carthage. All rights reserved.
//

import Foundation
import LlamaKit

let commandTypes : [CommandType] = [
	HelpCommand(),
	CheckoutCommand(),
]

var arguments = Process.arguments
assert(arguments.count >= 1)

arguments.removeAtIndex(0)
if arguments.count == 0 {
	arguments.append(HelpCommand().verb)
}

let verb = arguments[0]
var command: CommandType? = nil

if let match = find(commandTypes.map { $0.verb }, verb) {
	arguments.removeAtIndex(0)
	command = commandTypes[match]
} else {
	println("Unrecognized command: \(verb)")
	command = HelpCommand()
}

let result = command!.run(arguments)
switch result {
case let .Success(_):
	exit(EXIT_SUCCESS)

case let .Failure(error):
	fputs("Error executing command \(verb): \(error)", stderr)
	exit(EXIT_FAILURE)
}
<commit_msg>commandTypes -> commands.<commit_after>//
//  main.swift
//  Carthage
//
//  Created by <NAME> on 2014-10-10.
//  Copyright (c) 2014 Carthage. All rights reserved.
//

import Foundation
import LlamaKit

let commands : [CommandType] = [
	HelpCommand(),
	CheckoutCommand(),
]

var arguments = Process.arguments
assert(arguments.count >= 1)

arguments.removeAtIndex(0)
if arguments.count == 0 {
	arguments.append(HelpCommand().verb)
}

let verb = arguments[0]
var command: CommandType? = nil

if let match = find(commands.map { $0.verb }, verb) {
	arguments.removeAtIndex(0)
	command = commands[match]
} else {
	println("Unrecognized command: \(verb)")
	command = HelpCommand()
}

let result = command!.run(arguments)
switch result {
case let .Success(_):
	exit(EXIT_SUCCESS)

case let .Failure(error):
	fputs("Error executing command \(verb): \(error)", stderr)
	exit(EXIT_FAILURE)
}

{'fraction_non_alphanumeric': 0.14569160997732428, 'fraction_numerical': 0.02040816326530612, 'mean_word_length': 4.397553516819572, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, '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': '7348317', 'n_tokens_mistral': 613, 'n_tokens_neox': 580, 'n_words': 151}