mas/App/main.swift

37 lines
965 B
Swift
Raw Normal View History

2015-07-11 10:30:30 +00:00
//
// main.swift
// mas-cli
//
// Created by Andrew Naylor on 11/07/2015.
// Copyright © 2015 Andrew Naylor. All rights reserved.
//
2018-07-04 20:56:10 +00:00
import Commandant
2015-07-11 10:30:30 +00:00
import Foundation
2016-09-17 12:58:38 +00:00
public struct StderrOutputStream: TextOutputStream {
public mutating func write(_ string: String) {
fputs(string, stderr)
}
}
2015-08-02 20:38:38 +00:00
let registry = CommandRegistry<MASError>()
let helpCommand = HelpCommand(registry: registry)
registry.register(AccountCommand())
2016-10-21 23:02:19 +00:00
registry.register(InfoCommand())
2015-08-02 20:38:38 +00:00
registry.register(InstallCommand())
registry.register(ListCommand())
2017-05-11 20:29:18 +00:00
registry.register(LuckyCommand())
registry.register(OutdatedCommand())
registry.register(ResetCommand())
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())
registry.register(UpgradeCommand())
2015-09-20 10:40:55 +00:00
registry.register(VersionCommand())
2015-08-02 20:38:38 +00:00
registry.register(helpCommand)
registry.main(defaultVerb: helpCommand.verb) { error in
2016-09-25 21:13:23 +00:00
printError(String(describing: error))
}