 public typealias CLIResult = Int32
 
 extension CLIResult {
-
+    
     public static var success: CLIResult {
         return 0
     }
-
+    
     public static var error: CLIResult {
         return 1
     }
-
+    
 }
 
 // MARK: - Compatibility
 
 #if os(Linux)
-typealias Regex = RegularExpression
-
+    typealias Regex = RegularExpression
+    
 #else
-typealias Regex = NSRegularExpression
-
+    typealias Regex = NSRegularExpression
+    
 #endif

        } catch let error as NSError {
            printError("An error occurred: \(error.localizedDescription)")
        }

        if helpCommand.executeOnCommandFailure {
            do {
                try helpCommand.execute()

import Foundation

public class CLI {
    
    // MARK: - Information
    
    public static var name = ""
    public static var version = "1.0"
    public static var description = ""
    
    private static var commands: [Command] = []
    private static var aliases: [String: String] = [:]
    
    public static var helpCommand: HelpCommand = DefaultHelpCommand()
    public static var versionCommand: Command = VersionCommand()
    
    // MARK: - Advanced customization
    
    public static var router: Router = DefaultRouter()
    public static var usageStatementGenerator: UsageStatementGenerator = DefaultUsageStatementGenerator()
    public static var misusedOptionsMessageGenerator: MisusedOptionsMessageGenerator = DefaultMisusedOptionsMessageGenerator()
    
    public static var argumentNodeParser: ArgumentNodeParser = DefaultArgumentNodeParser()
    public static var optionParser: OptionParser = DefaultOptionParser()
    public static var commandArgumentParser: CommandArgumentParser = DefaultCommandArgumentParser()
    
    // MARK: - Setup
    
    /**
     Sets the CLI up with basic information
     
     - Parameter name: name of the app, printed in the help message and command usage statements
     - Parameter version: version of the app, printed by the VersionCommand
     - Parameter description: description of the app, printed in the help message
     */
    public static func setup(name: String, version: String? = nil, description: String? = nil) {
        self.name = name
        
        if let version = version {
            self.version = version
        }
        
        if let description = description {
            self.description = description
        }
        
        alias(from: "-h", to: "help")
        alias(from: "-v", to: "version")
    }
    
    /**
     Registers a command with the CLI for routing and execution. All commands must be registered
     with this method or its siblings before calling `CLI.go()`
     
     - Parameter command: the command to be registered
     */
    public static func register(command: Command) {
        commands.append(command)
    }
    
    @available(*, unavailable, renamed: "register(command:)")
    public static func registerCommand(_ command: Command) {}
    
    /**
     Registers a group of commands with the CLI for routing and execution. All commands must be registered
     with this method or its siblings before calling `CLI.go()`
     
     - Parameter commands: the commands to be registered
     */
    public static func register(commands: [Command]) {
        commands.forEach { self.register(command: $0) }
    }
    
    @available(*, unavailable, renamed: "register(commands:)")
    public static func registerCommands(_ commands: [Command]) {}
    
    /**
     Registers a chainable command with the CLI for routing and execution.
     
     - Parameter commandName: the name of the new chainable command
     - Returns: a new chainable command for immediate chaining
     */
    public static func registerChainableCommand(name: String) -> ChainableCommand {
        let chainable = ChainableCommand(name: name)
        register(command: chainable)
        return chainable
    }
    
    @available(*, unavailable, renamed: "registerChainableCommand(name:)")
    public static func registerChainableCommand(commandName: String) -> ChainableCommand {
        return registerChainableCommand(name: commandName)
