2015-07-11 11:30:30 +01:00
|
|
|
//
|
|
|
|
// main.swift
|
|
|
|
// mas-cli
|
|
|
|
//
|
|
|
|
// Created by Andrew Naylor on 11/07/2015.
|
|
|
|
// Copyright © 2015 Andrew Naylor. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
2016-09-17 13:58:38 +01:00
|
|
|
public struct StderrOutputStream: TextOutputStream {
|
|
|
|
public mutating func write(_ string: String) {
|
2015-09-04 00:38:54 +01:00
|
|
|
fputs(string, stderr)
|
|
|
|
}
|
|
|
|
}
|
2015-08-02 21:38:38 +01:00
|
|
|
|
|
|
|
let registry = CommandRegistry<MASError>()
|
|
|
|
let helpCommand = HelpCommand(registry: registry)
|
|
|
|
registry.register(AccountCommand())
|
|
|
|
registry.register(InstallCommand())
|
2015-09-13 23:14:14 +01:00
|
|
|
registry.register(ListCommand())
|
|
|
|
registry.register(OutdatedCommand())
|
2016-09-14 19:17:27 +01:00
|
|
|
registry.register(ResetCommand())
|
2016-04-14 12:27:07 -07:00
|
|
|
registry.register(SearchCommand())
|
2016-02-14 01:22:33 +00:00
|
|
|
registry.register(SignInCommand())
|
2016-02-14 01:33:17 +00:00
|
|
|
registry.register(SignOutCommand())
|
2015-12-30 21:03:45 +00:00
|
|
|
registry.register(UpgradeCommand())
|
2015-09-20 11:40:55 +01:00
|
|
|
registry.register(VersionCommand())
|
2015-08-02 21:38:38 +01:00
|
|
|
registry.register(helpCommand)
|
|
|
|
|
2015-09-04 00:13:47 +01:00
|
|
|
registry.main(defaultVerb: helpCommand.verb) { error in
|
2016-09-25 22:13:23 +01:00
|
|
|
printError(String(describing: error))
|
2015-09-04 00:13:47 +01:00
|
|
|
}
|
2015-07-11 11:30:30 +01:00
|
|
|
|