-
Notifications
You must be signed in to change notification settings - Fork 229
/
Copy pathmain.swift
37 lines (33 loc) · 993 Bytes
/
main.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
// main.swift
// SourceKitten
//
// Created by JP Simard on 2015-01-03.
// Copyright (c) 2015 SourceKitten. All rights reserved.
//
// swiftlint:disable sorted_imports
import Commandant
#if os(Linux)
import Glibc
#else
import Darwin
#endif
import Dispatch
// `sourcekitd_set_notification_handler()` sets the handler to be executed on main thread queue.
// So, we vacate main thread to `dispatchMain()`.
DispatchQueue.global(qos: .default).async {
let registry = CommandRegistry<SourceKittenError>()
registry.register(CompleteCommand())
registry.register(DocCommand())
registry.register(FormatCommand())
registry.register(IndexCommand())
registry.register(SyntaxCommand())
registry.register(StructureCommand())
registry.register(RequestCommand())
registry.register(VersionCommand())
registry.register(HelpCommand(registry: registry))
registry.main(defaultVerb: "help") { error in
fputs("\(error)\n", stderr)
}
}
dispatchMain()